Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (86 sloc) 4.29 KB

hibernate: How to Use Hibernate 5 in an Application

The hibernate quickstart demonstrates how to use Hibernate ORM 5 API over JPA, using Hibernate-Core and Hibernate Bean Validation, and EJB.

What is it?

The hibernate quickstart is based upon the kitchensink example, but demonstrates how to use Hibernate Object/Relational Mapping (ORM) 5 over JPA in {productNameFull}.

This project is setup to allow you to create a compliant {javaVersion} application using JSF, CDI, EJB, JPA , Hibernate-Core and Hibernate Bean Validation. It includes a persistence unit associated with Hibernate session and some sample persistence and transaction code to help you with database access in enterprise Java.

Add the Correct Dependencies

{productName} provides Hibernate 5 and JPA support.

If you use Hibernate 5 packaged within {productName}, you will need to first import the JPA API.

This quickstart demonstrates usage of Hibernate Session and Hibernate Validators.

If you look at the pom.xml file in the root of the hibernate quickstart directory, you will see that the dependencies for the Hibernate modules have been added with the scope as provided.

For example:


Access the Application

The application will be running at the following URL: http://localhost:8080/{artifactId}/.

Server Log: Expected Warnings and Errors

You will see the following warnings in the server log. You can ignore these warnings.

WFLYJCA0091: -ds.xml file deployments are deprecated. Support may be removed in a future version.

HHH000431: Unable to determine H2 database version, certain features may not work

You might see the following message when you run the command. It indicates the source is not provided in the third-party antlr JAR.

[INFO] The following files have NOT been resolved:
[INFO]    antlr:antlr:jar:sources:2.7.7:provided
You can’t perform that action at this time.