HHH-4848 simplify the non-jpa 2 case a bit further
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18701 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
c18a9306b9
commit
ab4f51dce5
|
@ -307,17 +307,6 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
public Object getIdentifier(Object entity, EntityMode entityMode, SessionFactoryImplementor factory) {
|
public Object getIdentifier(Object entity, EntityMode entityMode, SessionFactoryImplementor factory) {
|
||||||
Object id = mappedIdentifierType.instantiate( entityMode );
|
Object id = mappedIdentifierType.instantiate( entityMode );
|
||||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
||||||
Type[] subTypes = virtualIdComponent.getSubtypes();
|
|
||||||
Type[] copierSubTypes = mappedIdentifierType.getSubtypes();
|
|
||||||
final int length = subTypes.length;
|
|
||||||
for ( int i = 0 ; i < length; i++ ) {
|
|
||||||
//JPA 2 in @IdClass points to the pk of the entity
|
|
||||||
if ( subTypes[i].isAssociationType() && ! copierSubTypes[i].isAssociationType()) {
|
|
||||||
final String associatedEntityName = ( ( EntityType ) subTypes[i] ).getAssociatedEntityName();
|
|
||||||
final EntityPersister entityPersister = factory.getEntityPersister( associatedEntityName );
|
|
||||||
propertyValues[i] = entityPersister.getIdentifier( propertyValues[i], entityMode );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mappedIdentifierType.setPropertyValues( id, propertyValues, entityMode );
|
mappedIdentifierType.setPropertyValues( id, propertyValues, entityMode );
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue