This project provides a basic implementation of a login, registration, and logout using Java with Maven and MySQL. It leverages the MVC (Model-View-Controller) pattern, similar to that used in Laravel.
Before you start using this project, make sure you have the following installed:
- Java JDK (Java Development Kit), if other versions are not working, try using Java version "22.0.1"
- Maven for dependency management
- MySQL or XAMPP for the database
- Preferred IDE - Apache Netbeans
First, clone this repository to your local machine using:
git clone https://github.com/Resaizu/Base-Code-Java-Maven.gitor download the zip file
Download the MySQL Connector for Java (version 8.0.17) from: MySQL Connector/J 8.0.17 Archive
Assuming you used Windows
- Recommended Product Version: 8.0.17
- Operating System: Platform Independent
- Download the ZIP file
- Extract the ZIP file and add the .jar file to your project’s library or configure it in your IDE to include it in the build path.
Ensure the MySQL service is running.
- Create a new database named course_project, or use a database of your choice:
- If you choose a different database, update the connection settings in the Repository/Database > find "course_project" and replace it using your database name.
- Create users table manually or use this:
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
username VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
Import the project into your preferred IDE that supports Maven projects (e.g., Apache Netbeans, IntelliJ IDEA, Eclipse).
This project is primarily for educational purposes and is not well maintained. But Feel free to fork the repository, make improvements, and submit pull requests.
This project is open source and available under the MIT License.
- DB:
where: Retrieves data from a column based on a search value. Supports comparison methods likeLIKE, !=, <>, >,or refer to MySql manual.- Example:
User.DB.where("name", value, "LIKE").get();
- Example:
orWhere: Similar towhere, but finds all possible data. Must havewherebefore or it will throw an error.- Example:
User.DB.where("name", value, "LIKE").orWhere("username", value).get();
- Example:
get: Retrieves all data from a specific table.- Example:
User.DB.get();
- Example:
create: Stores data in the database.- Example:
User.DB.create(data);
- Example:
update: Updates data.- Example:
User.DB.update(data, User.id);
- Example:
delete: Removes specific data from the database.- Example:
User.DB.delete(User.id);
- Example: