Class HibernatePersistenceConfiguration

java.lang.Object
jakarta.persistence.PersistenceConfiguration
org.hibernate.jpa.HibernatePersistenceConfiguration

public class HibernatePersistenceConfiguration extends PersistenceConfiguration
Extends the Jakarta Persistence-defined PersistenceConfiguration with operations specific to Hibernate.

An instance of Configuration may be obtained simply by instantiation, and may be used to aggregate:

Standard JPA configuration properties are enumerated by the supertype PersistenceConfiguration. All configuration properties understood by Hibernate are enumerated by AvailableSettings.

 SessionFactory factory = new HibernatePersistenceConfiguration()
     // scan classes for mapping annotations
     .managedClasses(Item.class, Bid.class, User.class)
     // set a configuration property
     .setProperty(PersistenceConfiguration.JDBC_DATASOURCE,
                  "java:comp/env/jdbc/test")
     .buildSessionFactory();
 

When instantiated, an instance of HibernatePersistenceConfiguration has its properties initially populated from the environment, including:

Since:
7.0
API Note:
The specification explicitly encourages implementors to extend PersistenceConfiguration to accommodate vendor-specific extensions in a more typesafe way. Of course, programs which desire configuration logic to be portable between JPA providers should use PersistenceConfiguration directly.