diff --git a/documentation/src/main/asciidoc/introduction/Interacting.adoc b/documentation/src/main/asciidoc/introduction/Interacting.adoc index f3286caa5d4c..ae1ac8b660f4 100644 --- a/documentation/src/main/asciidoc/introduction/Interacting.adoc +++ b/documentation/src/main/asciidoc/introduction/Interacting.adoc @@ -1309,7 +1309,7 @@ class BookQueries {} We have to make sure that the class with the `@NamedQuery` annotation will be scanned by Hibernate, either: - by adding `org.hibernate.example.BookQueries` to `persistence.xml`, or -- by calling `configuration.addClass(BookQueries.class)`. +- by calling `persistenceConfiguration.managedClass(BookQueries.class)`. [TIP] ==== diff --git a/hibernate-core/src/main/java/org/hibernate/Interceptor.java b/hibernate-core/src/main/java/org/hibernate/Interceptor.java index e40854b2f330..0e9bb720c46b 100644 --- a/hibernate-core/src/main/java/org/hibernate/Interceptor.java +++ b/hibernate-core/src/main/java/org/hibernate/Interceptor.java @@ -39,11 +39,14 @@ * Whichever approach is used, the interceptor must be serializable for the * {@code Session} to be serializable. This means that {@code SessionFactory}-scoped * interceptors should implement {@code readResolve()}. - *

- * This venerable callback interface, dating to the very earliest days of Hibernate, - * competes with JPA entity listener callbacks: {@link jakarta.persistence.PostLoad}, - * {@link jakarta.persistence.PrePersist} {@link jakarta.persistence.PreUpdate}, and - * {@link jakarta.persistence.PreRemove}. + * + * @apiNote This venerable callback interface, dating from the very earliest days of + * Hibernate, competes with standard JPA entity listener callbacks: + * {@link jakarta.persistence.PostLoad}, {@link jakarta.persistence.PrePersist}, + * {@link jakarta.persistence.PreUpdate}, and {@link jakarta.persistence.PreRemove}. + * However, JPA callbacks do not provide the ability to access the previous + * value of an updated property in a {@code @PreUpdate} callback, and do not + * provide a well-defined way to intercept changes to collections. * * @see SessionBuilder#interceptor(Interceptor) * @see SharedSessionBuilder#interceptor() diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java index f38c4efd84ec..4f335d64a751 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java @@ -77,8 +77,11 @@ * annotated classes}, or {@linkplain #addFile XML mapping documents}. * *

- * Note that XML mappings may be expressed using the JPA {@code orm.xml} - * format, or in Hibernate's legacy {@code .hbm.xml} format. + * Note that XML mappings may be expressed using either: + *

*

* Configuration properties are enumerated by {@link AvailableSettings}. *

@@ -262,8 +265,7 @@ public Configuration setProperties(Properties properties) { * @return The value currently associated with that property name; may be null. */ public String getProperty(String propertyName) { - Object o = properties.get( propertyName ); - return o instanceof String ? (String) o : null; + return properties.get( propertyName ) instanceof String property ? property : null; } /** @@ -758,11 +760,6 @@ public Configuration addClass(Class entityClass) throws MappingException { if ( entityClass == null ) { throw new IllegalArgumentException( "The specified class cannot be null" ); } - - if ( log.isDebugEnabled() ) { - log.debugf( "adding resource mappings from class convention : %s", entityClass.getName() ); - } - return addResource( entityClass.getName().replace( '.', '/' ) + ".hbm.xml" ); }