/** * Convenience method to locate the identifier type of the associated entity. * * @param session The originating session * * @return The identifier type */ Type getIdentifierType(final SharedSessionContractImplementor session) { final Type type = associatedIdentifierType; if ( type == null ) { associatedIdentifierType = getIdentifierType( session.getFactory() ); return associatedIdentifierType; } else { return type; } }
/** * Determine the type of either (1) the identifier if we reference the * associated entity's PK or (2) the unique key to which we refer (i.e. * the property-ref). * * @param factory The mappings... * * @return The appropriate type. * * @throws MappingException Generally, if unable to resolve the associated entity name * or unique key property name. */ public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException { if ( isReferenceToPrimaryKey() || uniqueKeyPropertyName == null ) { return getIdentifierType( factory ); } else { Type type = factory.getReferencedPropertyType( getAssociatedEntityName(), uniqueKeyPropertyName ); if ( type.isEntityType() ) { type = ( (EntityType) type ).getIdentifierOrUniqueKeyType( factory ); } return type; } }
/** * {@inheritDoc} */ public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException { if ( !isEmbeddedInXML ) { return getIdentifierType(factory).fromXMLNode(xml, factory); } else { return xml; } }
/** * Convenience method to locate the identifier type of the associated entity. * * @param session The originating session * @return The identifier type */ Type getIdentifierType(SessionImplementor session) { return getIdentifierType( session.getFactory() ); }
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException { if ( !isEmbeddedInXML ) { return getIdentifierType(factory).fromXMLNode(xml, factory); } else { return xml; } }
/** * {@inheritDoc} */ public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException { if ( !isEmbeddedInXML ) { return getIdentifierType(factory).fromXMLNode(xml, factory); } else { return xml; } }
/** * Convenience method to locate the identifier type of the associated entity. * * @param session The originating session * @return The identifier type */ Type getIdentifierType(SessionImplementor session) { return getIdentifierType( session.getFactory() ); }
Type getIdentifierType(SessionImplementor session) throws MappingException { return getIdentifierType( session.getFactory() ); }
public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException { if ( isReferenceToPrimaryKey() ) { return getIdentifierType(factory); } else { return factory.getPropertyType( getAssociatedEntityName(), uniqueKeyPropertyName ); } }
/** * {@inheritDoc} */ public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException { if ( !isEmbeddedInXML ) { getIdentifierType(factory).setToXMLNode(node, value, factory); } else { Element elt = (Element) value; replaceNode( node, new ElementWrapper(elt) ); } }
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException { if ( !isEmbeddedInXML ) { getIdentifierType(factory).setToXMLNode(node, value, factory); } else { Element elt = (Element) value; replaceNode( node, new ElementWrapper(elt) ); } }
/** * {@inheritDoc} */ public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException { if ( !isEmbeddedInXML ) { getIdentifierType(factory).setToXMLNode(node, value, factory); } else { Element elt = (Element) value; replaceNode( node, new ElementWrapper(elt) ); } }
public boolean isDirty(Object old, Object current, SessionImplementor session) throws HibernateException { if ( isSame( old, current, session.getEntityMode() ) ) return false; Object oldid = getIdentifier(old, session); Object newid = getIdentifier(current, session); return !getIdentifierType(session).isSame( oldid, newid, session.getEntityMode() ); }
/** * Determine the type of either (1) the identifier if we reference the * associated entity's PK or (2) the unique key to which we refer (i.e. * the property-ref). * * @param factory The mappings... * @return The appropriate type. * @throws MappingException Generally, if unable to resolve the associated entity name * or unique key property name. */ public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException { if ( isReferenceToPrimaryKey() ) { return getIdentifierType(factory); } else { Type type = factory.getReferencedPropertyType( getAssociatedEntityName(), uniqueKeyPropertyName ); if ( type.isEntityType() ) { type = ( ( EntityType ) type).getIdentifierOrUniqueKeyType( factory ); } return type; } }
/** * Determine the type of either (1) the identifier if we reference the * associated entity's PK or (2) the unique key to which we refer (i.e. * the property-ref). * * @param factory The mappings... * @return The appropriate type. * @throws MappingException Generally, if unable to resolve the associated entity name * or unique key property name. */ public final Type getIdentifierOrUniqueKeyType(Mapping factory) throws MappingException { if ( isReferenceToPrimaryKey() ) { return getIdentifierType(factory); } else { Type type = factory.getReferencedPropertyType( getAssociatedEntityName(), uniqueKeyPropertyName ); if ( type.isEntityType() ) { type = ( ( EntityType ) type).getIdentifierOrUniqueKeyType( factory ); } return type; } }