@Override public boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session) { return filterHelper.isAffectedBy( session.getLoadQueryInfluencers().getEnabledFilters() ) || ( isManyToMany() && manyToManyFilterHelper.isAffectedBy( session.getLoadQueryInfluencers().getEnabledFilters() ) ); }
public void disableFetchProfile(String name) throws UnknownProfileException { checkFetchProfileName( name ); enabledFetchProfileNames.remove( name ); }
@Override public void disableFetchProfile(String name) throws UnknownProfileException { loadQueryInfluencers.disableFetchProfile( name ); }
private boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session) { return session.getLoadQueryInfluencers().hasEnabledFilters() && filterHelper.isAffectedBy( session.getLoadQueryInfluencers().getEnabledFilters() ); }
PropertyPath path, int propertyNumber) { if ( !loadQueryInfluencers.hasEnabledFetchProfiles() ) { final String fetchRole = persister.getEntityName() + "." + relativePropertyPath; for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) { final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName ); final Fetch fetch = profile.getFetchByRole( fetchRole ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) {
protected final boolean isJoinFetchEnabledByProfile(OuterJoinLoadable persister, PropertyPath path, int propertyNumber) { if ( !getLoadQueryInfluencers().hasEnabledFetchProfiles() ) { // perf optimization return false; } // ugh, this stuff has to be made easier... final String fullPath = path.getFullPath(); String rootPropertyName = persister.getSubclassPropertyName( propertyNumber ); int pos = fullPath.lastIndexOf( rootPropertyName ); String relativePropertyPath = pos >= 0 ? fullPath.substring( pos ) : rootPropertyName; String fetchRole = persister.getEntityName() + "." + relativePropertyPath; for ( String profileName : getLoadQueryInfluencers().getEnabledFetchProfileNames() ) { final FetchProfile profile = getFactory().getFetchProfile( profileName ); final Fetch fetch = profile.getFetchByRole( fetchRole ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { return true; } } return false; }
for ( String filterName : loadQueryInfluencers.getEnabledFilterNames() ) { ( (FilterImpl) loadQueryInfluencers.getEnabledFilter( filterName ) ).afterDeserialize( getFactory() );
public SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options) { super( factory, options ); this.actionQueue = new ActionQueue( this ); this.persistenceContext = new StatefulPersistenceContext( this ); this.sessionOwner = options.getSessionOwner(); initializeFromSessionOwner( sessionOwner ); this.autoClear = options.shouldAutoClear(); this.autoClose = options.shouldAutoClose(); this.queryParametersValidationEnabled = options.isQueryParametersValidationEnabled(); this.disallowOutOfTransactionUpdateOperations = !factory.getSessionFactoryOptions().isAllowOutOfTransactionUpdateOperations(); this.discardOnClose = getFactory().getSessionFactoryOptions().isReleaseResourcesOnCloseEnabled(); if ( options instanceof SharedSessionCreationOptions && ( (SharedSessionCreationOptions) options ).isTransactionCoordinatorShared() ) { final SharedSessionCreationOptions sharedOptions = (SharedSessionCreationOptions) options; if ( sharedOptions.getTransactionCompletionProcesses() != null ) { actionQueue.setTransactionCompletionProcesses( sharedOptions.getTransactionCompletionProcesses(), true ); } } loadQueryInfluencers = new LoadQueryInfluencers( factory ); if ( getFactory().getStatistics().isStatisticsEnabled() ) { getFactory().getStatistics().openSession(); } // NOTE : pulse() already handles auto-join-ability correctly getTransactionCoordinator().pulse(); setDefaultProperties(); applyProperties(); if ( TRACE_ENABLED ) { log.tracef( "Opened Session [%s] at timestamp: %s", getSessionIdentifier(), getTimestamp() ); } }
private boolean isAffectedByEnabledFetchProfiles(SharedSessionContractImplementor session) { for ( String s : session.getLoadQueryInfluencers().getEnabledFetchProfileNames() ) { if ( affectingFetchProfileNames.contains( s ) ) { return true; } } return false; }
@Override public void disableFilter(String filterName) { checkOpen(); checkTransactionSynchStatus(); loadQueryInfluencers.disableFilter( filterName ); }
@Override public Filter getEnabledFilter(String filterName) { checkTransactionSynchStatus(); return loadQueryInfluencers.getEnabledFilter( filterName ); }
@Override public Filter enableFilter(String filterName) { checkOpen(); checkTransactionSynchStatus(); return loadQueryInfluencers.enableFilter( filterName ); }
@Override public void enableFetchProfile(String name) throws UnknownProfileException { loadQueryInfluencers.enableFetchProfile( name ); }
public static QueryKey from( String sqlQueryString, Limit limit, QueryParameterBindings parameterBindings, SharedSessionContractImplementor persistenceContext) { // todo (6.0) : here is where we should centralize cacheable-or-not // if this method returns null, the query should be considered un-cacheable // // todo (6.0) : should limited (first/max) results be cacheable? // todo (6.0) : should filtered results be cacheable? final Limit limitToUse = limit == null ? Limit.NONE : limit; return new QueryKey( sqlQueryString, parameterBindings.generateQueryKeyMemento(), limitToUse.getFirstRow(), limitToUse.getMaxRows(), persistenceContext.getTenantIdentifier(), persistenceContext.getLoadQueryInfluencers().getEnabledFilterNames() ); }
@Override public boolean isAffectedByEnabledFilters(LoadQueryInfluencers loadQueryInfluencers) { assert filterHelper != null; return loadQueryInfluencers.hasEnabledFilters() && filterHelper.isAffectedBy( loadQueryInfluencers.getEnabledFilters() ); }
for ( String filterName : loadQueryInfluencers.getEnabledFilterNames() ) { ((FilterImpl) loadQueryInfluencers.getEnabledFilter( filterName )).afterDeserialize( factory );
protected final boolean isJoinFetchEnabledByProfile(OuterJoinLoadable persister, PropertyPath path, int propertyNumber) { if ( !getLoadQueryInfluencers().hasEnabledFetchProfiles() ) { // perf optimization return false; } // ugh, this stuff has to be made easier... final String fullPath = path.getFullPath(); String rootPropertyName = persister.getSubclassPropertyName( propertyNumber ); int pos = fullPath.lastIndexOf( rootPropertyName ); String relativePropertyPath = pos >= 0 ? fullPath.substring( pos ) : rootPropertyName; String fetchRole = persister.getEntityName() + "." + relativePropertyPath; Iterator profiles = getLoadQueryInfluencers().getEnabledFetchProfileNames().iterator(); while ( profiles.hasNext() ) { final String profileName = ( String ) profiles.next(); final FetchProfile profile = getFactory().getFetchProfile( profileName ); final Fetch fetch = profile.getFetchByRole( fetchRole ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { return true; } } return false; }
CriteriaImpl c = (CriteriaImpl) criteria; SessionImpl s = (SessionImpl) c.getSession(); SessionFactoryImplementor factory = (SessionFactoryImplementor) s.getSessionFactory(); String[] implementors = factory.getImplementors(c.getEntityOrClassName()); LoadQueryInfluencers lqis = new LoadQueryInfluencers(); CriteriaLoader loader = new CriteriaLoader((OuterJoinLoadable) factory.getEntityPersister(implementors[0]), factory, c, implementors[0], lqis); Field f = OuterJoinLoader.class.getDeclaredField("sql"); f.setAccessible(true); String sql = (String) f.get(loader);
private static Boolean isEagerFetchProfile(SharedSessionContractImplementor session, String role) { LoadQueryInfluencers loadQueryInfluencers = session.getLoadQueryInfluencers(); for ( String fetchProfileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) { FetchProfile fp = session.getFactory().getFetchProfile( fetchProfileName ); Fetch fetch = fp.getFetchByRole( role ); if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { return true; } } return null; }
@Override public void disableFilter(String filterName) { checkOpen(); checkTransactionSynchStatus(); loadQueryInfluencers.disableFilter( filterName ); }