FileDocCategorySizeDatePackage
SpecialOneToOneType.javaAPI DocHibernate 3.2.52975Mon Jun 20 15:32:36 BST 2005org.hibernate.type

SpecialOneToOneType

public class SpecialOneToOneType extends OneToOneType
A one-to-one association that maps to specific formula(s) instead of the primary key column of the owning entity.
author
Gavin King

Fields Summary
Constructors Summary
public SpecialOneToOneType(String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, String entityName, String propertyName)

		super(
				referencedEntityName, 
				foreignKeyType, 
				uniqueKeyPropertyName, 
				lazy,
				unwrapProxy,
				true, 
				entityName, 
				propertyName
			);
	
Methods Summary
public java.lang.Objectassemble(java.io.Serializable oid, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)

		//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 java.io.Serializabledisassemble(java.lang.Object value, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)


		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 intgetColumnSpan(org.hibernate.engine.Mapping mapping)

		return super.getIdentifierOrUniqueKeyType(mapping).getColumnSpan(mapping);
	
public java.lang.Objecthydrate(java.sql.ResultSet rs, java.lang.String[] names, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)

		return super.getIdentifierOrUniqueKeyType( session.getFactory() )
			.nullSafeGet(rs, names, session, owner);
	
public int[]sqlTypes(org.hibernate.engine.Mapping mapping)

		return super.getIdentifierOrUniqueKeyType(mapping).sqlTypes(mapping);
	
public booleanuseLHSPrimaryKey()

		return false;