/** * @deprecated Use {@link TypeConfiguration}/{@link TypeConfiguration.Scope} instead */ @Deprecated public interface TypeScope extends Serializable { TypeConfiguration getTypeConfiguration(); }
@Override public Size[] defaultSizes(Mapping mapping) throws MappingException { return super.getIdentifierOrUniqueKeyType( mapping ).defaultSizes( mapping ); }
@Override public boolean isNull(Object owner, SharedSessionContractImplementor session) { if ( propertyName != null ) { final EntityPersister ownerPersister = session.getFactory().getMetamodel().entityPersister( entityName ); final Serializable id = session.getContextEntityIdentifier( owner ); final EntityKey entityKey = session.generateEntityKey( id, ownerPersister ); return session.getPersistenceContext().isPropertyNull( entityKey, getPropertyName() ); } else { return false; } }
@Override public Object assemble(Serializable oid, SharedSessionContractImplementor session, Object owner) throws HibernateException { //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 ); }
private static boolean isOneToOneMatching(OgmEntityPersister mainSidePersister, String mainSideProperty, OneToOneType inversePropertyType) { SessionFactoryImplementor factory = mainSidePersister.getFactory(); String associatedProperty = inversePropertyType.getRHSUniqueKeyPropertyName(); // If that's a OneToOne check the associated property name and see if it matches where we come from return mainSidePersister == inversePropertyType.getAssociatedJoinable( factory ) && mainSideProperty.equals( associatedProperty ); }
@Override public boolean isForeignJoinColumn(EntityType<?> ownerType, String attributeName) { AbstractEntityPersister persister = getEntityPersister(ownerType); Type propertyType = persister.getPropertyType(attributeName); if (propertyType instanceof OneToOneType) { OneToOneType oneToOneType = (OneToOneType) propertyType; // It is foreign if there is a mapped by attribute // But as of Hibernate 5.4 we noticed that we have to treat nullable one-to-ones as "foreign" as well return (oneToOneType).getRHSUniqueKeyPropertyName() != null || isNullable(oneToOneType); } // Every entity persister has "owned" properties on table number 0, others have higher numbers int tableNumber = persister.getSubclassPropertyTableNumber(attributeName); return tableNumber >= persister.getEntityMetamodel().getSubclassEntityNames().size(); }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //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 ); }
@Override public String getMappedBy(EntityType<?> ownerType, String attributeName) { CollectionPersister persister = getCollectionPersister(ownerType, attributeName); if (persister != null) { if (persister.isInverse()) { return getMappedBy(persister); } else if (persister instanceof OneToManyPersister) { // A one-to-many association without a join table is like an inverse association return ""; } } else { EntityPersister entityPersister = getEntityPersister(ownerType); Type propertyType = entityPersister.getPropertyType(attributeName); if (propertyType instanceof OneToOneType) { return ((OneToOneType) propertyType).getRHSUniqueKeyPropertyName(); } } return null; }
@Override public Size[] dictatedSizes(Mapping mapping) throws MappingException { return super.getIdentifierOrUniqueKeyType( mapping ).dictatedSizes( mapping ); }
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 boolean isNull(Object owner, SessionImplementor session) { if ( propertyName != null ) { final EntityPersister ownerPersister = session.getFactory().getEntityPersister( entityName ); final Serializable id = session.getContextEntityIdentifier( owner ); final EntityKey entityKey = session.generateEntityKey( id, ownerPersister ); return session.getPersistenceContext().isPropertyNull( entityKey, getPropertyName() ); } else { return false; } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //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.getEntityIdentifier(owner), session, owner ); }
public int[] sqlTypes(Mapping mapping) throws MappingException { return super.getIdentifierOrUniqueKeyType( mapping ).sqlTypes( mapping ); }
public EntityType oneToOne( String persistentClass, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, String entityName, String propertyName) { return new OneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName, lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName ); }
public boolean isNull(Object owner, SessionImplementor session) { if ( propertyName != null ) { final EntityPersister ownerPersister = session.getFactory().getEntityPersister( entityName ); final Serializable id = session.getContextEntityIdentifier( owner ); final EntityKey entityKey = session.generateEntityKey( id, ownerPersister ); return session.getPersistenceContext().isPropertyNull( entityKey, getPropertyName() ); } else { return false; } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //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 int getColumnSpan(Mapping mapping) throws MappingException { return super.getIdentifierOrUniqueKeyType( mapping ).getColumnSpan( mapping ); }
public EntityType oneToOne( String persistentClass, ForeignKeyDirection foreignKeyType, String uniqueKeyPropertyName, boolean lazy, boolean unwrapProxy, boolean isEmbeddedInXML, String entityName, String propertyName) { return new OneToOneType( typeScope, persistentClass, foreignKeyType, uniqueKeyPropertyName, lazy, unwrapProxy, isEmbeddedInXML, entityName, propertyName ); }
public boolean isNull(Object owner, SessionImplementor session) { if ( propertyName != null ) { EntityPersister ownerPersister = session.getFactory().getEntityPersister(entityName); Serializable id = session.getEntityIdentifier(owner); EntityKey entityKey = new EntityKey( id, ownerPersister, session.getEntityMode() ); return session.getPersistenceContext().isPropertyNull( entityKey, getPropertyName() ); } else { return false; } }
public Object assemble(Serializable oid, SessionImplementor session, Object owner) throws HibernateException { //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 ); }