/** * For a collection role, return a list of associations to be fetched by outerjoin */ protected final void walkCollectionTree(QueryableCollection persister, String alias) throws MappingException { walkCollectionTree( persister, alias, new PropertyPath(), 0 ); //TODO: when this is the entry point, we should use an INNER_JOIN for fetching the many-to-many elements! }
protected final void initProjection( final String projectionString, final String whereString, final String orderByString, final String groupByString, final LockOptions lockOptions) throws MappingException { walkEntityTree( persister, getAlias() ); persisters = new Loadable[0]; initStatementString(projectionString, whereString, orderByString, groupByString, lockOptions); }
/** * Utility method that generates 0_, 1_ suffixes. Subclasses don't * necessarily need to use this algorithm, but it is intended that * they will in most cases. * * @param length The number of suffixes to generate * * @return The array of generated suffixes (with length=length). */ public static String[] generateSuffixes(int length) { return generateSuffixes( 0, length ); }
protected void initFromWalker(JoinWalker walker) { persisters = walker.getPersisters(); collectionPersisters = walker.getCollectionPersisters(); ownerAssociationTypes = walker.getOwnerAssociationTypes(); lockOptions = walker.getLockModeOptions(); lockModeArray = walker.getLockModeArray(); suffixes = walker.getSuffixes(); collectionSuffixes = walker.getCollectionSuffixes(); owners = walker.getOwners(); collectionOwners = walker.getCollectionOwners(); sql = walker.getSQLString(); aliases = walker.getAliases(); }
public int getOwner(final List associations) { if ( isOneToOne() || isCollection() ) { return getPosition( lhsAlias, associations ); } else { return -1; } }
protected String orderBy(final List associations, final String orderBy) { return mergeOrderings( orderBy( associations ), orderBy ); }
public static OuterJoinableAssociation createRoot( AssociationType joinableType, String alias, SessionFactoryImplementor factory) { return new OuterJoinableAssociation( new PropertyPath(), joinableType, null, null, alias, JoinType.LEFT_OUTER_JOIN, null, false, factory, Collections.EMPTY_MAP ); }
/** * Walk the association tree for an entity, adding associations which should * be join fetched to the {@link #associations} inst var. This form is the * entry point into the walking for a given entity, starting the recursive * calls into {@link #walkEntityTree(org.hibernate.persister.entity.OuterJoinLoadable, String, PropertyPath, int)}. * * @param persister The persister representing the entity to be walked. * @param alias The (root) alias to use for this entity/persister. * * @throws org.hibernate.MappingException ??? */ protected final void walkEntityTree( OuterJoinLoadable persister, String alias) throws MappingException { walkEntityTree( persister, alias, new PropertyPath(), 0 ); }
/** * For entities, orderings added by, for example, Criteria#addOrder need to come before the associations' @OrderBy * values. However, other sub-classes of JoinWalker (BasicCollectionJoinWalker, OneToManyJoinWalker, etc.) * still need the other way around. So, override here instead. See HHH-7116. */ @Override protected String orderBy(final List associations, final String orderBy) { return mergeOrderings( orderBy, orderBy( associations ) ); }
private boolean isEagerPropertyFetchEnabled(int i) { boolean[] array = getEntityEagerPropertyFetches(); return array != null && array[i]; }
private String[][] determinePropertyAliases(Loadable persister) { return getSuffixedPropertyAliases( persister ); }
/** * Execute an SQL query and attempt to instantiate instances of the class mapped by the given * persister from each row of the <tt>ResultSet</tt>. If an object is supplied, will attempt to * initialize that object. If a collection is supplied, attempt to initialize that collection. */ public List doQueryAndInitializeNonLazyCollections( final SharedSessionContractImplementor session, final QueryParameters queryParameters, final boolean returnProxies) throws HibernateException, SQLException { return doQueryAndInitializeNonLazyCollections( session, queryParameters, returnProxies, null ); }
protected boolean hasSubselectLoadableCollections() { final Loadable[] loadables = getEntityPersisters(); for ( Loadable loadable : loadables ) { if ( loadable.hasSubselectLoadableCollections() ) { return true; } } return false; }
public CollectionFetchableIndexAnyGraph(CollectionReference collectionReference) { super( // this property path is just informational... collectionReference.getPropertyPath().append( "<index>" ) ); this.collectionReference = collectionReference; }
/** * The superclass deliberately excludes collections */ protected boolean isJoinedFetchEnabled(AssociationType type, FetchMode config, CascadeStyle cascadeStyle) { return isJoinedFetchEnabledInMapping( config, type ); }
public AbstractEntityJoinWalker( OuterJoinLoadable persister, SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers, String alias) { super( factory, loadQueryInfluencers ); this.persister = persister; this.alias = ( alias == null ) ? generateRootAlias( persister.getEntityName() ) : alias; }
private String extractFullPath(PropertyPath path) { return path == null ? "<no-path>" : path.getFullPath(); }
public PropertyPath append(String property) { return new PropertyPath( this, property ); }
private String generateEntitySuffix() { return BasicLoader.generateSuffixes( entitySuffixSeed++, 1 )[0]; }
public CollectionFetchableElementCompositeGraph( CollectionReference collectionReference, ExpandingCompositeQuerySpace compositeQuerySpace) { super( compositeQuerySpace, false, // these property paths are just informational... collectionReference.getPropertyPath().append( "<element>" ) ); this.collectionReference = collectionReference; }