IMDBlite is a Java-based Command Line Interface (CLI) application designed to manage and explore a movie database. It leverages JPA (Jakarta Persistence) and Hibernate to interact with a MySQL database, following a "Code First" approach.
The application features a dual-interface system: a User Menu for movie enthusiasts to browse, rate, and favorite movies, and an Admin Menu for database management.
- Browse Movies: List all movies or filter by language, ranking, length, release date, actor, director, or genre.
- Search: Find specific movies by title.
- Personal Favorites: Maintain a personal list of favorite movies.
- Ratings: Rate movies (1-5 scale) and view your previous ratings.
- User Search: Find other users by their username.
- User Management: Add or delete users.
- Content Management: Create and delete movies, actors, directors, and genres.
- Relationships: Associate actors and directors with specific movies.
- Validation: Basic input validation for names, dates, and numeric values.
- Language: Java 25
- Persistence: Jakarta Persistence (JPA) & Hibernate 7.2.0.Final
- Database: MySQL (Driver: mysql-connector-j 9.5.0)
- Build Tool: Maven
- Testing: JUnit 5, AssertJ, Mockito
- Development Utility: ClassGraph (for classpath scanning)
The project uses a relational data model with the following entities:
- Movie: The central entity containing title, release date, length, and language.
- Actor & Director: Entities containing name and country of origin.
- Genre: Categorizes movies.
- User: Manages login credentials and profile information.
- UserRating: A join entity representing the rating given by a User to a Movie.
Key Relations:
- One-to-Many: One Director can have many Movies.
- Many-to-Many:
- Movies <-> Actors
- Movies <-> Genres
- Users <-> Favorite Movies
- Java 25 or higher.
- MySQL Server running locally.
- Maven for dependency management.
The database connection is configured programmatically in src/main/java/org/example/JpaUtil.java. By default, it looks for:
- URL:
jdbc:mysql://localhost:3306/codeTraumaTeam - User:
user - Password:
password
Ensure you have a database named codeTraumaTeam created, or update the settings in JpaUtil.java to match your local environment.
- Clone the repository:
git clone <repository-url>
- Build the project:
mvn clean install
- Run the application:
mvn exec:java -Dexec.mainClass="org.example.App"
On the first launch, the application detects if the database is empty. If so, it automatically triggers the DatabaseFiller to seed the database with initial data (movies, actors, directors, etc.) to get you started immediately.
src/main/java/org/example/entity: JPA Entity definitions.src/main/java/org/example/repo: Repository interfaces.src/main/java/org/example/jpaimpl: JPA-specific implementations of the repositories.src/main/java/org/example/seed: Data seeding logic.src/main/java/org/example/CliApp.java: Main logic for the User CLI.src/main/java/org/example/CliAdminApp.java: Main logic for the Admin CLI.