diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java index 043bbb4f1b..4429c81c58 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/AttributeTypeDescriptor.java @@ -8,6 +8,7 @@ package org.hibernate.bytecode.enhance.internal; import java.util.Collection; import java.util.Locale; +import javax.persistence.EmbeddedId; import javax.persistence.Id; import javassist.CtClass; @@ -34,24 +35,15 @@ public abstract class AttributeTypeDescriptor { final StringBuilder builder = new StringBuilder(); try { // should ignore primary keys - if (PersistentAttributesHelper.hasAnnotation( currentValue, Id.class ) ) { + if ( PersistentAttributesHelper.hasAnnotation( currentValue, Id.class ) + || PersistentAttributesHelper.hasAnnotation( currentValue, EmbeddedId.class ) ) { return ""; } - // primitives || enums if ( currentValue.getType().isPrimitive() || currentValue.getType().isEnum() ) { + // primitives || enums builder.append( String.format( " if (%s != $1)", currentValue.getName() ) ); } - // simple data types - else if ( currentValue.getType().getName().startsWith( "java.lang" ) - || currentValue.getType().getName().startsWith( "java.math.Big" ) - || currentValue.getType().getName().startsWith( "java.sql.Time" ) - || currentValue.getType().getName().startsWith( "java.sql.Date" ) - || currentValue.getType().getName().startsWith( "java.util.Date" ) - || currentValue.getType().getName().startsWith( "java.util.Calendar" ) ) { - builder.append( String.format( " if (%s == null || !%