@Override public void setIdentifier(Object entity, Serializable id, SharedSessionContractImplementor session) { if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) { if ( entity != id ) { CompositeType copier = (CompositeType) entityMetamodel.getIdentifierProperty().getType(); copier.setPropertyValues( entity, copier.getPropertyValues( id, getEntityMode() ), getEntityMode() ); } } else if ( idSetter != null ) { idSetter.set( entity, id, getFactory() ); } else if ( identifierMapperType != null ) { mappedIdentifierValueMarshaller.setIdentifier( entity, id, getEntityMode(), session ); } }
id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
/** * Extract a component property value. * * @param type The component property types. * @param component The component instance itself. * @param propertyPath The property path for the property to be extracted. * @return The property value extracted. */ protected Object getComponentValue(ComponentType type, Object component, String propertyPath) { final int loc = propertyPath.indexOf( '.' ); final String basePropertyName = loc > 0 ? propertyPath.substring( 0, loc ) : propertyPath; final int index = findSubPropertyIndex( type, basePropertyName ); final Object baseValue = type.getPropertyValue( component, index, getEntityMode() ); if ( loc > 0 ) { if ( baseValue == null ) { return null; } return getComponentValue( (ComponentType) type.getSubtypes()[index], baseValue, propertyPath.substring(loc+1) ); } else { return baseValue; } }
/** * Extract a component property value. * * @param type The component property types. * @param component The component instance itself. * @param propertyPath The property path for the property to be extracted. * @return The property value extracted. */ protected Object getComponentValue(ComponentType type, Object component, String propertyPath) { final int loc = propertyPath.indexOf( '.' ); final String basePropertyName = loc > 0 ? propertyPath.substring( 0, loc ) : propertyPath; final int index = findSubPropertyIndex( type, basePropertyName ); final Object baseValue = type.getPropertyValue( component, index, getEntityMode() ); if ( loc > 0 ) { if ( baseValue == null ) { return null; } return getComponentValue( (ComponentType) type.getSubtypes()[index], baseValue, propertyPath.substring(loc+1) ); } else { return baseValue; } }
/** * {@inheritDoc} */ public void setIdentifier(Object entity, Serializable id, SessionImplementor session) { if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) { if ( entity != id ) { CompositeType copier = (CompositeType) entityMetamodel.getIdentifierProperty().getType(); copier.setPropertyValues( entity, copier.getPropertyValues( id, getEntityMode() ), getEntityMode() ); } } else if ( idSetter != null ) { idSetter.set( entity, id, getFactory() ); } else if ( identifierMapperType != null ) { mappedIdentifierValueMarshaller.setIdentifier( entity, id, getEntityMode(), session ); } }
/** * {@inheritDoc} */ public void setIdentifier(Object entity, Serializable id, SessionImplementor session) { if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) { if ( entity != id ) { CompositeType copier = (CompositeType) entityMetamodel.getIdentifierProperty().getType(); copier.setPropertyValues( entity, copier.getPropertyValues( id, getEntityMode() ), getEntityMode() ); } } else if ( idSetter != null ) { idSetter.set( entity, id, getFactory() ); } else if ( identifierMapperType != null ) { mappedIdentifierValueMarshaller.setIdentifier( entity, id, getEntityMode(), session ); } }