|
13 | 13 | import org.hibernate.cache.spi.access.AccessType; |
14 | 14 | import org.hibernate.cfg.AvailableSettings; |
15 | 15 | import org.hibernate.cfg.CacheSettings; |
| 16 | +import org.hibernate.cfg.Environment; |
16 | 17 | import org.hibernate.cfg.JdbcSettings; |
17 | 18 | import org.hibernate.cfg.JpaComplianceSettings; |
18 | 19 | import org.hibernate.cfg.MappingSettings; |
|
29 | 30 | import jakarta.persistence.ValidationMode; |
30 | 31 |
|
31 | 32 | /** |
32 | | - * Hibernate extension to the Jakarta Persistence {@link PersistenceConfiguration} |
33 | | - * contract. |
| 33 | + * Extends the Jakarta Persistence-defined {@link PersistenceConfiguration} |
| 34 | + * with operations specific to Hibernate. |
| 35 | + * <p> |
| 36 | + * An instance of {@code Configuration} may be obtained simply by |
| 37 | + * {@linkplain #HibernatePersistenceConfiguration(String) instantiation}, |
| 38 | + * and may be used to aggregate: |
| 39 | + * <ul> |
| 40 | + * <li>{@linkplain #property(String, Object) configuration properties} |
| 41 | + * from various sources, and |
| 42 | + * <li>entity O/R mappings, defined in either |
| 43 | + * {@linkplain #managedClasses(Class...) annotated classes}, or |
| 44 | + * {@linkplain #mappingFiles(Collection) XML mapping documents}. |
| 45 | + * </ul> |
| 46 | + * <p> |
| 47 | + * Standard JPA configuration properties are enumerated by the supertype |
| 48 | + * {@link PersistenceConfiguration}. All configuration properties understood |
| 49 | + * by Hibernate are enumerated by {@link AvailableSettings}. |
| 50 | + * <p> |
| 51 | + * <pre> |
| 52 | + * SessionFactory factory = new HibernatePersistenceConfiguration() |
| 53 | + * // scan classes for mapping annotations |
| 54 | + * .managedClasses(Item.class, Bid.class, User.class) |
| 55 | + * // set a configuration property |
| 56 | + * .setProperty(PersistenceConfiguration.JDBC_DATASOURCE, |
| 57 | + * "java:comp/env/jdbc/test") |
| 58 | + * .buildSessionFactory(); |
| 59 | + * </pre> |
| 60 | + * <p> |
| 61 | + * When instantiated, an instance of |
| 62 | + * {@code HibernatePersistenceConfiguration} has its properties initially |
| 63 | + * populated from the {@linkplain Environment#getProperties() environment}, |
| 64 | + * including: |
| 65 | + * <ul> |
| 66 | + * <li>JVM {@linkplain System#getProperties() system properties}, and |
| 67 | + * <li>properties specified in {@code hibernate.properties}. |
| 68 | + * </ul> |
34 | 69 | * |
35 | 70 | * @apiNote The specification explicitly encourages implementors to extend |
36 | 71 | * {@link PersistenceConfiguration} to accommodate vendor-specific |
|
0 commit comments