Skip to content

Commit fd8ceaf

Browse files
committed
HHH-19671 - Avoid issuing a callback warning when a class defines an IdClass and has lifecycle callbacks
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 5595894 commit fd8ceaf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

hibernate-core/src/main/java/org/hibernate/jpa/event/internal/CallbackDefinitionResolver.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.hibernate.internal.util.ReflectHelper;
1818
import org.hibernate.jpa.event.spi.CallbackDefinition;
1919
import org.hibernate.jpa.event.spi.CallbackType;
20+
import org.hibernate.mapping.Component;
2021
import org.hibernate.mapping.PersistentClass;
2122
import org.hibernate.mapping.Property;
2223
import org.hibernate.models.spi.AnnotationDescriptor;
@@ -282,7 +283,9 @@ public static void resolveLifecycleCallbacks(
282283
// code was added by HHH-12326
283284
collector.addSecondPass( persistentClasses -> {
284285
for ( Property property : persistentClass.getDeclaredProperties() ) {
285-
if ( property.isComposite() ) {
286+
if ( property.getValue() instanceof Component component
287+
// embedded components don't have their own class, so no need to check callbacks (see HHH-19671)
288+
&& !component.isEmbedded() ) {
286289
try {
287290
final Class<?> mappedClass = persistentClass.getMappedClass();
288291
for ( CallbackType type : CallbackType.values() ) {

0 commit comments

Comments
 (0)