OneToOneTypepublic class OneToOneType extends EntityType A one-to-one association to an entity |
Fields Summary |
---|
private final ForeignKeyDirection | foreignKeyType | private final String | propertyName | private final String | entityName |
Constructors Summary |
---|
public OneToOneType(String referencedEntityName, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, String entityName, String propertyName)
super(
referencedEntityName,
uniqueKeyPropertyName,
!lazy,
isEmbeddedInXML,
unwrapProxy
);
this.foreignKeyType = foreignKeyType;
this.propertyName = propertyName;
this.entityName = entityName;
|
Methods Summary |
---|
public java.lang.Object | assemble(java.io.Serializable oid, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
//this should be a call to resolve(), not resolveIdentifier(),
//'cos it might be a property-ref, and we did not cache the
//referenced value
return resolve( session.getContextEntityIdentifier(owner), session, owner );
| public java.io.Serializable | disassemble(java.lang.Object value, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
return null;
| public int | getColumnSpan(org.hibernate.engine.Mapping session)
return 0;
| public ForeignKeyDirection | getForeignKeyDirection()
return foreignKeyType;
| public java.lang.String | getPropertyName()
return propertyName;
| public java.lang.Object | hydrate(java.sql.ResultSet rs, java.lang.String[] names, org.hibernate.engine.SessionImplementor session, java.lang.Object owner)
return session.getContextEntityIdentifier(owner);
| public boolean | isAlwaysDirtyChecked()We don't need to dirty check one-to-one because of how
assemble/disassemble is implemented and because a one-to-one
association is never dirty
//TODO: this is kinda inconsistent with CollectionType
return false;
| public boolean | isDirty(java.lang.Object old, java.lang.Object current, org.hibernate.engine.SessionImplementor session)
return false;
| public boolean | isDirty(java.lang.Object old, java.lang.Object current, boolean[] checkable, org.hibernate.engine.SessionImplementor session)
return false;
| public boolean | isModified(java.lang.Object old, java.lang.Object current, boolean[] checkable, org.hibernate.engine.SessionImplementor session)
return false;
| public boolean | isNull(java.lang.Object owner, org.hibernate.engine.SessionImplementor session)
if ( propertyName != null ) {
EntityPersister ownerPersister = session.getFactory()
.getEntityPersister(entityName);
Serializable id = session.getContextEntityIdentifier(owner);
EntityKey entityKey = new EntityKey( id, ownerPersister, session.getEntityMode() );
return session.getPersistenceContext()
.isPropertyNull( entityKey, getPropertyName() );
}
else {
return false;
}
| protected boolean | isNullable()
return foreignKeyType==ForeignKeyDirection.FOREIGN_KEY_TO_PARENT;
| public boolean | isOneToOne()
return true;
| public void | nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, boolean[] settable, org.hibernate.engine.SessionImplementor session)
//nothing to do
| public void | nullSafeSet(java.sql.PreparedStatement st, java.lang.Object value, int index, org.hibernate.engine.SessionImplementor session)
//nothing to do
| public int[] | sqlTypes(org.hibernate.engine.Mapping session)
return ArrayHelper.EMPTY_INT_ARRAY;
| public boolean[] | toColumnNullness(java.lang.Object value, org.hibernate.engine.Mapping mapping)
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
| public boolean | useLHSPrimaryKey()
return true;
|
|