For the past two decades, Hibernate, a cornerstone of Java data persistence, has thrived under the stewardship of JBoss and Red Hat. Today, the project announces a significant shift: its move to the Commonhaus Foundation, a neutral ground for open-source projects.
Hibernate JPA
The Java Persistence API (JPA) is a lightweight, POJO-based framework for Java persistence.
By using a standard persistence API, you can fetch, persist and manage data between Java objects and a Relational Database.
WildFly application server uses Hibernate ORM as JPA Provider. Within this section, you will find tutorials both for Hibernate standalone applications and for Jakarta Persistence API.
Latest Hibernate version – September 2024
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>7.0.0.Beta1</version> </dependency>
Here is the index of our Resources:
Hibernate ORM
Hibernate quickstart 1 (Eclipse)
Hibernate quickstart 2 (Maven)
Hibernate quickstart 3 (Managed Environment)
Configure a connection pool with Hibernate
Using Hibernate annotations in your applications
Using custom SQL for Hibernate CRUD Operations
How to use ScrollableResults with Hibernate
JPA
Java Persistence API quickstart 1
Java Persistence API quickstart 2 (Maven)
How to access Hibernate Session in JPA applications
How to enable Second Level Cache on WildFly
How to map a BLOB field with JPA
JPA vs Hibernate in a nutshell
Using LocalDate and LocalDateTime with JPA
Data Fetching
How to count records in JPA using a NamedQuery
How to call a stored procedure from Hibernate / JPA
How to limit the number of records in a Query with JPA
How to configure a Query timeout
How to paginate your Entity data
How to return Collections and other Types in EJB QL
How to use Oracle hints in your query
JPA/Hibernate Query Performance Tuning
Updates
How to disable updates for a field of an Entity EJB?
How to enable cascade delete/update?
Entity Relations
One to One Hibernate/JPA Example
One to Many Hibernate/JPA example
Many to Many Hibernate/JPA Example
How to lazy load your Entity relations
Primary key
How to configure a Composite Primary key in JPA applications
How to bind the Id of an Entity to a DB Sequence
How to map MySQL auto increment field
How to map an Oracle Sequence with JPA
Entity Hierarchy
Mapping Table per Concrete Class
Using Table per Class hierarchy
Using Table per Subclass strategy
Embedding Entities in other Entities
Hibernate Search and Criteria
Debugging
How to enable statistics with Hibernate and JPA
persistence.xml
How to use Environment variables in your persistence.xml ?
Solving “Syntax error in SQL statement: expected “identifier”
When working with JPA (Java Persistence API) and defining entity classes, it’s crucial to avoid using reserved words as identifiers for attributes or table names. Failure to do so may lead to SQL syntax errors, as demonstrated by the given issue.
In this tutorial, we’ll walk through the steps to resolve the SQL syntax error caused by using reserved words in a JPA entity class.
Hibernate @SoftDelete Step-by-Step Guide
@SoftDelete
annotation, introduced in Hibernate version 6.4, provides first-class support for soft deletes, allowing to logically mark rows rows as deleted without actually removing them from the Database. In this tutorial we will see a proof of concept example of @SoftDelete
and its common configuration attributes.
3 ways to set a Query timeout for JPA / Hibernate applications
In JPA (Java Persistence API) and Hibernate applications, queries can sometimes take a long time to execute, especially when working with large data sets. To avoid long-running queries, it’s important to set a query timeout, which limits the maximum amount of time that a query is allowed to run before it times out. In this tutorial, we will learn how to set a query timeout for JPA/Hibernate applications.
Java Persistence (JPA) Tutorial with WildFly
Jakarta Persistence API (JPA) is a Java specification for accessing, persisting, and managing data between Java objects/classes and a relational database. It is a part of the Jakarta EE platform, and it provides a standard approach for ORM (Object-Relational Mapping). In this JPA tutorial, we will learn how to use JPA to create, read, update, and delete (CRUD) data in a database.