Skip to content

vasile007/java-hibernate-crud-application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛠️ Java Hibernate CRUD Application

This is a simple CRUD (Create, Read, Update, Delete) application built with Java and Hibernate ORM, using MySQL as the database. It demonstrates basic operations on a User entity using JPA and Hibernate.


📖 About

The project shows how to perform basic database operations using Hibernate ORM. It includes full examples of creating, reading, updating, and deleting data from a MySQL database.


🧰 Technologies Used

  • Java 11+
  • Hibernate 5.x
  • MySQL 8+
  • Maven
  • JPA (Java Persistence API)
  • Log4j (logging)

⚙️ Installation & Setup

  1. Clone the repository

    git clone https://github.com/vasile007/java-hibernate-crud-application.git
    cd java-hibernate-crud-application
  2. Configure database connection
    Open src/main/resources/hibernate.cfg.xml and set your database credentials:

    <property name="connection.url">jdbc:mysql://localhost:3306/your_database</property>
    <property name="connection.username">your_username</property>
    <property name="connection.password">your_password</property>
  3. Build the project

    mvn clean install
  4. Run the application
    Run the Main.java class from your IDE or terminal.


🚀 Usage

This project manages a simple User entity with fields such as id, name, and email. All CRUD operations are implemented in a UserDAO class.


🧪 Example CRUD Operations

// Create
User user = new User("John Doe", "john@example.com");
userDao.saveUser(user);

// Read
User retrieved = userDao.getUserById(1);

// Update
retrieved.setName("Jane Doe");
userDao.updateUser(retrieved);

// Delete
userDao.deleteUserById(1);

🤝 Contributing Contributions are welcome! Here's how to contribute:

  1. Fork the repository

  2. Create a new branch: git checkout -b feature-name

  3. Commit your changes: git commit -m 'Add feature'

  4. Push to your branch: git push origin feature-name

  5. Open a Pull Request

🛡️ License This project is licensed under the MIT License. See the LICENSE file for details.

📧 Contact Thank you and feel free to open an issue or contact me at: bejan.vasi@yahoo.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages