Join( SessionFactoryImplementor factory, AssociationType associationType, String alias, JoinType joinType, String[][] lhsColumns) throws MappingException { this.associationType = associationType; this.joinable = associationType.getAssociatedJoinable( factory ); this.alias = alias; this.joinType = joinType; this.lhsColumns = lhsColumns; }
protected Joinable getJoinable() { if ( joinable == null ) { joinable = getType().getAssociatedJoinable( sessionFactory() ); } return joinable; }
public OuterJoinableAssociation( PropertyPath propertyPath, AssociationType joinableType, String lhsAlias, String[] lhsColumns, String rhsAlias, JoinType joinType, String withClause, boolean hasRestriction, SessionFactoryImplementor factory, Map enabledFilters) throws MappingException { this.propertyPath = propertyPath; this.joinableType = joinableType; this.lhsAlias = lhsAlias; this.lhsColumns = lhsColumns; this.rhsAlias = rhsAlias; this.joinType = joinType; this.joinable = joinableType.getAssociatedJoinable( factory ); this.rhsColumns = JoinHelper.getRHSColumnNames( joinableType, factory ); this.on = joinableType.getOnCondition( rhsAlias, factory, enabledFilters ) + ( withClause == null || withClause.trim().length() == 0 ? "" : " and ( " + withClause + " )" ); this.hasRestriction = hasRestriction; this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application }
private static boolean isSubsequentSelectDelayed(AssociationType type, SessionFactoryImplementor sessionFactory) { if ( type.isAnyType() ) { // we'd need more context here. this is only kept as part of the property state on the owning entity return false; } else if ( type.isEntityType() ) { return ( (EntityPersister) type.getAssociatedJoinable( sessionFactory ) ).hasProxy(); } else { final CollectionPersister cp = ( (CollectionPersister) type.getAssociatedJoinable( sessionFactory ) ); return cp.isLazy() || cp.isExtraLazy(); } }
@Override public EntityDefinition toEntityDefinition() { if ( !getType().isEntityType() ) { throw new IllegalStateException( "Cannot treat collection index type as entity" ); } return (EntityPersister) ( (AssociationType) getIndexType() ).getAssociatedJoinable( getFactory() ); }
/** * Get the columns of the associated table which are to be used in the join * * @param type The type * @param factory The SessionFactory * * @return The columns for the right-hand-side of the join */ public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) { final String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName(); final Joinable joinable = type.getAssociatedJoinable( factory ); if ( uniqueKeyPropertyName == null ) { return joinable.getKeyColumnNames(); } else { return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames( uniqueKeyPropertyName ); } }
protected Joinable getJoinable() { if ( getAssociationNature() == AssociationNature.ANY ) { throw new WalkingException( "Cannot resolve AnyType to a Joinable" ); } if ( joinable == null ) { joinable = getType().getAssociatedJoinable( sessionFactory() ); } return joinable; }
public String selectFragment( Joinable rhs, String rhsAlias, String lhsAlias, String entitySuffix, String collectionSuffix, boolean includeCollectionColumns) { // we need to determine the best way to know that two joinables // represent a single many-to-many... if ( rhs != null && isManyToMany() && !rhs.isCollection() ) { AssociationType elementType = ( (AssociationType) getElementType() ); if ( rhs.equals( elementType.getAssociatedJoinable( getFactory() ) ) ) { return manyToManySelectFragment( rhs, rhsAlias, lhsAlias, collectionSuffix ); } } return includeCollectionColumns ? selectFragment( lhsAlias, collectionSuffix ) : ""; }
EntityPersister persister = (EntityPersister) type.getAssociatedJoinable( sessionFactory ); if ( persister.isBatchLoadable() ) { return FetchStyle.BATCH; CollectionPersister persister = (CollectionPersister) type.getAssociatedJoinable( sessionFactory ); if ( persister instanceof AbstractCollectionPersister && ( (AbstractCollectionPersister) persister ).isSubselectLoadable() ) {
/** * Used to detect circularities in the joined graph, note that * this method is side-effecty */ protected boolean isDuplicateAssociation( final String lhsTable, final String[] lhsColumnNames, final AssociationType type) { final String foreignKeyTable; final String[] foreignKeyColumns; if ( type.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { foreignKeyTable = lhsTable; foreignKeyColumns = lhsColumnNames; } else { foreignKeyTable = type.getAssociatedJoinable( getFactory() ).getTableName(); foreignKeyColumns = JoinHelper.getRHSColumnNames( type, getFactory() ); } return isDuplicateAssociation( foreignKeyTable, foreignKeyColumns ); }
final JoinType joinType) throws MappingException { Joinable joinable = type.getAssociatedJoinable( getFactory() );
final Joinable joinable = type.getAssociatedJoinable( sessionFactory() );
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns) throws MappingException { this.associationType = associationType; this.joinable = associationType.getAssociatedJoinable( factory ); this.alias = alias; this.joinType = joinType; this.lhsColumns = lhsColumns; }
Join(AssociationType associationType, String alias, int joinType, String[] lhsColumns) throws MappingException { this.associationType = associationType; this.joinable = associationType.getAssociatedJoinable( factory ); this.alias = alias; this.joinType = joinType; this.lhsColumns = lhsColumns; }
Join(AssociationType associationType, String alias, JoinType joinType, String[] lhsColumns) throws MappingException { this.associationType = associationType; this.joinable = associationType.getAssociatedJoinable( factory ); this.alias = alias; this.joinType = joinType; this.lhsColumns = lhsColumns; }
Join(AssociationType associationType, String alias, JoinType joinType, String[] lhsColumns) throws MappingException { this.associationType = associationType; this.joinable = associationType.getAssociatedJoinable( factory ); this.alias = alias; this.joinType = joinType; this.lhsColumns = lhsColumns; }
/** * Get the columns of the associated table which are to * be used in the join */ public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) { String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName(); Joinable joinable = type.getAssociatedJoinable(factory); if (uniqueKeyPropertyName==null) { return joinable.getKeyColumnNames(); } else { return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName); } } }
/** * Get the columns of the associated table which are to * be used in the join */ public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) { String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName(); Joinable joinable = type.getAssociatedJoinable(factory); if (uniqueKeyPropertyName==null) { return joinable.getKeyColumnNames(); } else { return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName); } } }
/** * Get the columns of the associated table which are to * be used in the join */ public static String[] getRHSColumnNames(AssociationType type, SessionFactoryImplementor factory) { String uniqueKeyPropertyName = type.getRHSUniqueKeyPropertyName(); Joinable joinable = type.getAssociatedJoinable(factory); if (uniqueKeyPropertyName==null) { return joinable.getKeyColumnNames(); } else { return ( (OuterJoinLoadable) joinable ).getPropertyColumnNames(uniqueKeyPropertyName); } } }
@Override public Joinable getJoinable(final SessionFactoryImplementor factory) throws MappingException { try { final org.hibernate.engine.spi.SessionFactoryImplementor sessionFactoryV5 = (org.hibernate.engine.spi.SessionFactoryImplementor) HibernateBridge.get(factory).getV5SessionFactory(); return JoinableV2Adapter.adapt(type.getAssociatedJoinable(sessionFactoryV5), sessionFactoryV5); } catch (final org.hibernate.MappingException ex) { throw (MappingException) HibernateExceptionAdapter.adapt(ex); } }