Hibernate Framework Tutorials
- Details
- Written by Nam Ha Minh
- Last Updated on 22 October 2024   |   Print Email
1. Getting started with Hibernate for beginners:
If you're new to Hibernate, I recommend you start with the following tutorials written for absolute beginners. You'll learn how to code your first Java-Hibernate project with Eclipse IDE. Then you'll learn more about using JPA annotations in Java entity classes. The guide about forward engineering is also helpful - you'll learn how to create database tables from Java entity classes. And I also share various examples of writing Hibernate Query Language (HQL) in the last guide in this beginner series.- Hibernate Hello World Tutorial for Beginners with Eclipse and MySQL
- Java Hibernate JPA Annotations Tutorial for Beginners
- Hibernate Forward Engineering - Create Tables from Entity Classes
- Getting Started With Hibernate Annotations
- How to code a basic Java Hibernate program using Eclipse
- Hibernate Query Language (HQL) Examples
- Playlist on YouTube: Hibernate JPA for beginners
2. Hibernate Entity Relationship Mapping:
When using Hibernate, it's important to understand how to create mapping between Java entity classes and tables in relational database because the framework lets developers work with Java objects instead of manipulating rows in the database. The following examples will help you represent common entity relationships in Java entity classes, such as one-to-one, one-to-many, and many-to-many associations.Mapping One-to-One Entity Relationship:
In the following examples, you will learn how to represent different variants of the one-to-one entity relationship in Java entity classes (one-to-one with primary key and foreign key) using both XML mapping and JPA annotations.- Hibernate One-to-One With Primary Key XML Mapping Example
- Hibernate One-to-One Association on Primary Key Annotations Example
- Hibernate One-to-One With Foreign Key XML Mapping Example
- Hibernate One-to-One Mapping with Foreign Key Annotations Example
Mapping One-to-Many Entity Relationship:
Check the following guides about implement one-to-many associations in entity classes using both XML configuration and Java annotations. Besides the basic one-to-many entity relationship, you will also learn about the more advanced one (using join table). And the parent-child mapping is a special case.- Hibernate One-to-Many XML Mapping Example
- Hibernate One-to-Many Association Annotations Example
- Hibernate One-to-Many Using Join Table XML Mapping Example
- Hibernate One-to-Many Association on Join Table Annotations Example
- Hibernate Parent-Child Mapping Example
Mapping Many-to-Many Entity Relationship:
Learn how to model many-to-many association in Java entity classes with the following explanatory guides. There are also examples about mapping many-to-many entity relationship with extra columns in the join table.- Hibernate Many-to-Many XML Mapping Example
- Hibernate Many-to-Many Association Annotations Example
- Hibernate Many-to-Many Association with Extra Columns in Join Table Example
Other Hibernate Mapping Tutorials:
Hibernate makes it easy to map special data types in entity classes, such as enum, binary (byte array) and composite primary key. Learn how in the following articles:- Hibernate Enum Type Mapping Example
- Hibernate Binary Data and BLOB Mapping Example
- Hibernate Composite Primary Key Examples
Java Servlet, JSP and Hibernate: Build eCommerce Website
Code Functional Bookshop Website with Java Servlet and Hibernate framework. Full-stack Development. Job-ready Skills.
3. Hibernate Configuration:
In the following articles, I will show some examples about creating SessionFactory, using Java code-based configuration, and configuring log4j2 logging framework with Hibernate.- Building Hibernate SessionFactory from Service Registry
- Hibernate Programmatic Configuration Example
- How to configure Hibernate logging with log4j2
4. Advanced Hibernate Tutorials:
Check the following tutorials to learn about generating Java entity classes from tables in database (reverse engineering) and how Hibernate supports executing update queries in batch.- Java Hibernate Reverse Engineering Tutorial with Eclipse and MySQL
- How to customize Hibernate Reverse Engineering Code Generation
- How to Execute Batch Insert Update in Hibernate
5. Hibernate and Database Connection Pooling:
Learn how to use the database connection pooling libaries C3P0 and Proxool with Hibernate framework:- How to use c3p0 database connection pooling library with Hibernate/JPA
- How to configure Proxool with Hibernate/JPA
6. Hibernate Integration with other frameworks:
Check the following tutorials to learn how to use Hibernate with other frameworks like Spring and Struts in Java web applications:- Spring and Hibernate Integration Tutorial (Java-based Configuration)
- Spring MVC + Spring Data JPA + Hibernate - CRUD Example
- Struts - Spring - Hibernate Integration Tutorial
7. Miscellaneous Hibernate Tutorials:
Check a nice example that illustrates how to change database schema at runtime, how to work with Oracle database and different ways to delete entites in Hibernate.- Hibernate Change Database Dynamically at Runtime Example
- [Solved] JDBCConnectionException: Unable to acquire JDBC Connection with Hibernate and MySQL
- How to make Hibernate work with Oracle database
- Hibernate - 3 ways to delete an entity from the datastore