idGetter = buildPropertyGetter( mappingInfo.getIdentifierProperty(), mappingInfo ); idSetter = buildPropertySetter( mappingInfo.getIdentifierProperty(), mappingInfo ); getters[i] = buildPropertyGetter( property, mappingInfo ); setters[i] = buildPropertySetter( property, mappingInfo ); if ( !property.isBasicPropertyAccessor() ) { foundCustomAccessor = true; instantiator = buildInstantiator( entityMetamodel, mappingInfo ); proxyFactory = buildProxyFactory( mappingInfo, idGetter, idSetter ); if ( proxyFactory == null ) { entityMetamodel.setLazy( false ); mappedIdentifierValueMarshaller = buildMappedIdentifierValueMarshaller( getEntityName(), getFactory(), (ComponentType) entityMetamodel.getIdentifierProperty().getType(), (ComponentType) identifierMapperType
/** * 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 ); if ( loc > 0 ) { if ( baseValue == null ) { return null; } return getComponentValue( (ComponentType) type.getSubtypes()[index], baseValue, propertyPath.substring( loc + 1 ) ); } else { return baseValue; } }
@Override public Getter getVersionGetter() { if ( getEntityMetamodel().isVersioned() ) { return getGetter( getEntityMetamodel().getVersionPropertyIndex() ); } return null; }
final Object baseValue = getPropertyValue( entity, index ); if ( loc > 0 ) { if ( baseValue == null ) { return null; return getComponentValue( (ComponentType) entityMetamodel.getPropertyTypes()[index], baseValue,
idGetter = buildPropertyGetter( mappingInfo.getIdentifierProperty(), mappingInfo ); idSetter = buildPropertySetter( mappingInfo.getIdentifierProperty(), mappingInfo ); getters[i] = buildPropertyGetter(property, mappingInfo); setters[i] = buildPropertySetter(property, mappingInfo); if ( !property.isBasicPropertyAccessor() ) { foundCustomAccessor = true; instantiator = buildInstantiator( mappingInfo ); proxyFactory = buildProxyFactory( mappingInfo, idGetter, idSetter ); if (proxyFactory == null) { entityMetamodel.setLazy( false ); mappedIdentifierValueMarshaller = buildMappedIdentifierValueMarshaller( (ComponentType) entityMetamodel.getIdentifierProperty().getType(), (ComponentType) identifierMapperType
/** * 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; } }
@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 ); } }
if ( idGetter == null ) { if ( identifierMapperType == null ) { throw new HibernateException( "The class has no identifier property: " + getEntityName() ); id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
@Override public String toString() { return getClass().getName() + '(' + getEntityMetamodel().getName() + ')'; }
idGetter = buildPropertyGetter( mappingInfo.getIdentifierProperty(), mappingInfo ); idSetter = buildPropertySetter( mappingInfo.getIdentifierProperty(), mappingInfo ); getters[i] = buildPropertyGetter(property, mappingInfo); setters[i] = buildPropertySetter(property, mappingInfo); if ( !property.isBasicPropertyAccessor() ) { foundCustomAccessor = true; instantiator = buildInstantiator( mappingInfo ); proxyFactory = buildProxyFactory( mappingInfo, idGetter, idSetter ); if (proxyFactory == null) { entityMetamodel.setLazy( false ); mappedIdentifierValueMarshaller = buildMappedIdentifierValueMarshaller( (ComponentType) entityMetamodel.getIdentifierProperty().getType(), (ComponentType) identifierMapperType
/** * 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 ); } }
public Object getPropertyValue(Object entity, String propertyPath) throws HibernateException { int loc = propertyPath.indexOf('.'); String basePropertyName = loc > 0 ? propertyPath.substring( 0, loc ) : propertyPath; //final int index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); Integer index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); if (index == null) { propertyPath = "_identifierMapper." + propertyPath; loc = propertyPath.indexOf('.'); basePropertyName = loc > 0 ? propertyPath.substring( 0, loc ) : propertyPath; } index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); final Object baseValue = getPropertyValue( entity, index.intValue() ); if ( loc > 0 ) { if ( baseValue == null ) { return null; } return getComponentValue( (ComponentType) entityMetamodel.getPropertyTypes()[index.intValue()], baseValue, propertyPath.substring(loc+1) ); } else { return baseValue; } }
if ( idGetter == null ) { if (identifierMapperType==null) { throw new HibernateException( "The class has no identifier property: " + getEntityName() ); id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
protected boolean shouldGetAllProperties(Object entity) { if ( !getEntityMetamodel().getBytecodeEnhancementMetadata().isEnhancedForLazyLoading() ) { return true; } return !getEntityMetamodel().getBytecodeEnhancementMetadata().hasUnFetchedAttributes( entity ); }
idGetter = buildPropertyGetter( mappingInfo.getHierarchyDetails().getEntityIdentifier().getValueBinding() ); idSetter = buildPropertySetter( mappingInfo.getHierarchyDetails().getEntityIdentifier().getValueBinding() ); getters[ i ] = buildPropertyGetter( property ); setters[ i ] = buildPropertySetter( property ); if ( ! property.isBasicPropertyAccessor() ) { foundCustomAccessor = true; instantiator = buildInstantiator( mappingInfo ); proxyFactory = buildProxyFactory( mappingInfo, idGetter, idSetter ); if ( proxyFactory == null ) { entityMetamodel.setLazy( false ); mappedIdentifierValueMarshaller = buildMappedIdentifierValueMarshaller( ( ComponentType ) entityMetamodel.getIdentifierProperty().getType(), ( ComponentType ) identifierMapperType
public Getter getVersionGetter() { if ( getEntityMetamodel().isVersioned() ) { return getGetter( getEntityMetamodel().getVersionPropertyIndex() ); } return null; }
/** * {@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 ); } }
public Object getPropertyValue(Object entity, String propertyPath) throws HibernateException { int loc = propertyPath.indexOf('.'); String basePropertyName = loc > 0 ? propertyPath.substring( 0, loc ) : propertyPath; //final int index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); Integer index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); if (index == null) { propertyPath = "_identifierMapper." + propertyPath; loc = propertyPath.indexOf('.'); basePropertyName = loc > 0 ? propertyPath.substring( 0, loc ) : propertyPath; } index = entityMetamodel.getPropertyIndexOrNull( basePropertyName ); final Object baseValue = getPropertyValue( entity, index.intValue() ); if ( loc > 0 ) { if ( baseValue == null ) { return null; } return getComponentValue( (ComponentType) entityMetamodel.getPropertyTypes()[index.intValue()], baseValue, propertyPath.substring(loc+1) ); } else { return baseValue; } }
if ( idGetter == null ) { if (identifierMapperType==null) { throw new HibernateException( "The class has no identifier property: " + getEntityName() ); id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );