/** * @deprecated Use {@link TypeConfiguration}/{@link TypeConfiguration.Scope} instead */ @Deprecated public interface TypeScope extends Serializable { TypeConfiguration getTypeConfiguration(); }
@Override public Serializable disassemble(Object value, SharedSessionContractImplementor session, Object owner) throws HibernateException { if (value==null) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if (id==null) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType(session).disassemble(id, session, owner); } }
@Override public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner) throws HibernateException { //TODO: currently broken for unique-key references (does not detect // change to unique key property of the associated object) Serializable id = (Serializable) getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id if (id==null) { return null; } else { return resolveIdentifier(id, session); } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //TODO: currently broken for unique-key references (does not detect // change to unique key property of the associated object) Serializable id = (Serializable) getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id if ( isNotEmbedded(session) ) return id; if (id==null) { return null; } else { return resolveIdentifier(id, session); } }
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException { if ( isNotEmbedded(session) ) { return getIdentifierType(session).disassemble(value, session, owner); } if (value==null) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if (id==null) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType(session).disassemble(id, session, owner); } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //TODO: currently broken for unique-key references (does not detect // change to unique key property of the associated object) Serializable id = (Serializable) getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id if ( isNotEmbedded(session) ) return id; if (id==null) { return null; } else { return resolveIdentifier(id, session); } }
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException { if ( isNotEmbedded(session) ) { return getIdentifierType(session).disassemble(value, session, owner); } if (value==null) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if (id==null) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType(session).disassemble(id, session, owner); } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //TODO: currently broken for unique-key references (does not detect // change to unique key property of the associated object) Serializable id = (Serializable) getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id if ( isNotEmbedded(session) ) return id; if (id==null) { return null; } else { return resolveIdentifier(id, session); } }
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException { if ( isNotEmbedded(session) ) { return getIdentifierType(session).disassemble(value, session, owner); } if (value==null) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if (id==null) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType(session).disassemble(id, session, owner); } }
private Type getCommonType(MetadataImplementor metadata, EntityType entityType1, EntityType entityType2) { PersistentClass thisClass = metadata.getEntityBinding( entityType1.getAssociatedEntityName() ); PersistentClass otherClass = metadata.getEntityBinding( entityType2.getAssociatedEntityName() ); PersistentClass commonClass = getCommonPersistentClass( thisClass, otherClass ); if ( commonClass == null ) { return null; } // Create a copy of the type but with the common class if ( entityType1 instanceof ManyToOneType ) { ManyToOneType t = (ManyToOneType) entityType1; return new ManyToOneType( t, commonClass.getEntityName() ); } else if ( entityType1 instanceof SpecialOneToOneType ) { SpecialOneToOneType t = (SpecialOneToOneType) entityType1; return new SpecialOneToOneType( t, commonClass.getEntityName() ); } else if ( entityType1 instanceof OneToOneType ) { OneToOneType t = (OneToOneType) entityType1; return new OneToOneType( t, commonClass.getEntityName() ); } else { throw new IllegalStateException( "Unexpected entity type: " + entityType1 ); } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //TODO: currently broken for unique-key references (does not detect // change to unique key property of the associated object) Serializable id = (Serializable) getIdentifierType(session).assemble(oid, session, null); //the owner of the association is not the owner of the id if ( isNotEmbedded(session) ) return id; if (id==null) { return null; } else { return resolveIdentifier(id, session); } }
public Serializable disassemble(Object value, SessionImplementor session, Object owner) throws HibernateException { if ( isNotEmbedded(session) ) { return getIdentifierType(session).disassemble(value, session, owner); } if (value==null) { return null; } else { // cache the actual id of the object, not the value of the // property-ref, which might not be initialized Object id = ForeignKeys.getEntityIdentifierIfNotUnsaved( getAssociatedEntityName(), value, session ); if (id==null) { throw new AssertionFailure( "cannot cache a reference to an object with a null id: " + getAssociatedEntityName() ); } return getIdentifierType(session).disassemble(id, session, owner); } }
public EntityType specialOneToOne( String persistentClass, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName) { return new SpecialOneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName ); }
public EntityType specialOneToOne( String persistentClass, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName) { return new SpecialOneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName, lazy, unwrapProxy, entityName, propertyName ); }
public Type getType() throws MappingException { if ( getColumnIterator().hasNext() ) { return new SpecialOneToOneType( getReferencedEntityName(), foreignKeyType, referencedPropertyName, isLazy(), entityName, propertyName ); } else { return TypeFactory.oneToOne( getReferencedEntityName(), foreignKeyType, referencedPropertyName, isLazy(), isEmbedded(), entityName, propertyName ); } }
public Type getType() throws MappingException { if ( getColumnIterator().hasNext() ) { return new SpecialOneToOneType( getReferencedEntityName(), foreignKeyType, referencedPropertyName, isLazy(), isUnwrapProxy(), entityName, propertyName ); } else { return TypeFactory.oneToOne( getReferencedEntityName(), foreignKeyType, referencedPropertyName, isLazy(), isUnwrapProxy(), isEmbedded(), entityName, propertyName ); } }