org.hibernate.persister.entity.Loadable
| Modifier and Type | Class and Description |
|---|---|
| protected static class |
| Modifier and Type | Field and Description |
|---|---|
| private volatile ColumnNameCache | columnNameCache
Deprecated
as a consequence of
ColumnNameCache being deprecated.
|
| private final SessionFactoryImplementor | factory
Deprecated
as a consequence of
SessionFactoryImplementor being deprecated.
|
| private boolean | |
| protected static final CoreMessageLogger | |
| public static final String | |
| public static final String |
| Access | Constructor and Description |
|---|---|
| public | Loader(SessionFactoryImplementor factory)
Deprecated
as a consequence of
SessionFactoryImplementor being deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
| private void | advance(final ResultSet rs, final RowSelection selection)
Advance the cursor to the first required row of the ResultSet |
| protected String | applyLocks(String sql, QueryParameters parameters, Dialect dialect, List<AfterLoadAction> afterLoadActions)
Append FOR UPDATE OF clause, if necessary. |
| protected void | applyPostLoadLocks(Object[] row, LockMode[] lockModesArray, SharedSessionContractImplementor session)
|
| protected boolean | Returns: true, if getResultColumnOrRow() transforms the results; false, otherwiseAre rows transformed immediately after being read from the ResultSet? |
| protected void | |
| protected int | Returns: The number of JDBC bind positions actually bound during this method execution.The JDBC prepared statement statement, final Map<String, TypedValue> A map of parameter names to values namedParams, final int The position from which to start binding parameter values. startIndex, final SharedSessionContractImplementor The originating session. session)Bind named parameters to the JDBC prepared statement. |
| protected int | Returns: The number of JDBC bind positions actually bound during this method execution.The JDBC prepared statement statement, QueryParameters The encapsulation of the parameter values to be bound. queryParameters, int The position from which to start binding parameter values. startIndex, SharedSessionContractImplementor The originating session. session)Bind all parameter values into the prepared statement in preparation for execution. |
| protected int | Returns: The number of JDBC bind positions actually bound during this method execution.The JDBC prepared statement statement, final QueryParameters The encapsulation of the parameter values to be bound. queryParameters, final int The position from which to start binding parameter values. startIndex, final SharedSessionContractImplementor The originating session. session)Bind positional parameter values to the JDBC prepared statement. |
| protected final PreparedStatement | bindPreparedStatement(final PreparedStatement st, final QueryParameters queryParameters, final LimitHandler limitHandler, final SharedSessionContractImplementor session)
|
| private Map | |
| protected void | |
| private void | checkVersion(final int i, final Loadable persister, final Serializable id, final Object entity, final ResultSet rs, final SharedSessionContractImplementor session)
Check the version of the object in the ResultSet against the object version in the session cache, throwing an exception if the version numbers are different |
| protected CacheableResultTransformer | |
| protected void | createSubselects(List<E> keys, QueryParameters queryParameters, SharedSessionContractImplementor session)
|
| protected LockMode | |
| protected List | doList(final SharedSessionContractImplementor session, final QueryParameters queryParameters)
Actually execute a query, ignoring the query cache |
| private List | doList(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final ResultTransformer forcedResultTransformer)
|
| private List | doQuery(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final boolean returnProxies, final ResultTransformer forcedResultTransformer)
|
| public List | doQueryAndInitializeNonLazyCollections(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final boolean returnProxies)
Execute an SQL query and attempt to instantiate instances of the class mapped by the given persister from each row of the ResultSet. |
| public List | doQueryAndInitializeNonLazyCollections(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final boolean returnProxies, final ResultTransformer forcedResultTransformer)
|
| protected void | endCollectionLoad(final Object resultSetId, final SharedSessionContractImplementor session, final CollectionPersister collectionPersister)
|
| protected Loader. | executeQueryStatement(final QueryParameters queryParameters, final boolean scroll, List<AfterLoadAction> afterLoadActions, final SharedSessionContractImplementor session)
Process query string by applying filters, LIMIT clause, locks and comments if necessary. |
| protected Loader. | executeQueryStatement(String sqlStatement, QueryParameters queryParameters, boolean scroll, List<AfterLoadAction> afterLoadActions, SharedSessionContractImplementor session)
|
| protected void | extractKeysFromResultSet(Loadable[] persisters, QueryParameters queryParameters, ResultSet resultSet, SharedSessionContractImplementor session, EntityKey[] keys, LockMode[] lockModes, List<E> hydratedObjects)
|
| protected QueryKey | |
| protected String[] | getAliases()
Get the SQL table aliases of entities whose associations are subselect-loadable, returning null if this loader does not support subselect loading |
| protected abstract CollectionAliases[] | |
| protected int[] | getCollectionOwners()
Get the index of the entity that owns the collection, or -1 if there is no owner in the query results (ie. |
| protected CollectionPersister[] | getCollectionPersisters()
An (optional) persister for a collection to be initialized; only collection loaders return a non-null value |
| protected int[][] | |
| protected abstract EntityAliases[] | |
| protected boolean[][] | Returns: Eager property fetching indicators.An array indicating for each entity which specific properties must have eager fetching enabled. |
| protected boolean[] | Returns: Eager property fetching indicators.An array indicating whether the entities have eager property fetching enabled for all of their properties. |
| protected EntityPersister | |
| protected abstract Loadable[] | Returns: The entity persisters.An array of persisters of entity classes contained in each row of results; implemented by all subclasses |
| public final SessionFactoryImplementor | |
| private String | getInstanceClass(final ResultSet rs, final int i, final Loadable persister, final Serializable id, final SharedSessionContractImplementor session)
Determine the concrete class of an instance in the ResultSet |
| private EntityKey | getKeyFromResultSet(final int i, final Loadable persister, final Serializable id, final ResultSet rs, final SharedSessionContractImplementor session)
Read a row of Keys from the ResultSet into the given array. |
| protected LimitHandler | Returns: LIMIT clause delegate.Selection criteria. selection)Build LIMIT clause handler applicable for given selection criteria. |
| protected abstract LockMode[] | getLockModes(LockOptions
a collection of lock options specified dynamically via the Query interface lockOptions)What lock options does this load entities with? |
| public int[] | |
| protected static EntityKey | |
| protected EntityType[] | Returns: The types for the owners.An array of the owner types corresponding to the |
| protected int[] | Returns: The owner indicators (see discussion above).An array of indexes of the entity that owns a one-to-one association to the entity at the given index (-1 if there is no "owner"). |
| private boolean[] | |
| protected String | getQueryIdentifier()
Identifies the query for statistics reporting, if null, no statistics will be reported |
| protected Object | getResultColumnOrRow(Object[] row, ResultTransformer transformer, ResultSet rs, SharedSessionContractImplementor session)
Get the actual object that is returned in the user-visible result list. |
| protected List | getResultFromQueryCache(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final Set<Serializable> querySpaces, final Type[] resultTypes, final QueryResultsCache queryCache, final QueryKey key)
Deprecated
as a consequence of
QueryResultsCache being deprecated.
|
| protected List | |
| protected Object[] | |
| protected String[] | Returns: Returns the aliases that corresponding to a result row.Returns the aliases that corresponding to a result row. |
| protected final ResultSet | getResultSet(final PreparedStatement st, final RowSelection selection, final LimitHandler limitHandler, final boolean autodiscovertypes, final SharedSessionContractImplementor session)
Execute given PreparedStatement, advance to the first result and return SQL ResultSet. |
| protected final ResultSet | getResultSet(final CallableStatement st, final RowSelection selection, final LimitHandler limitHandler, final boolean autodiscovertypes, final SharedSessionContractImplementor session)
Execute given CallableStatement, advance to the first result and return SQL ResultSet. |
| private Object[] | getRow(final ResultSet rs, final Loadable[] persisters, final EntityKey[] keys, final Object optionalObject, final EntityKey optionalObjectKey, final LockMode[] lockModes, final List<E> hydratedObjects, final SharedSessionContractImplementor session)
Resolve any IDs for currently loaded objects, duplications within the ResultSet, etc. Instantiate empty objects to be initialized from the ResultSet. |
| private Object | getRowFromResultSet(final ResultSet resultSet, final SharedSessionContractImplementor session, final QueryParameters queryParameters, final LockMode[] lockModesArray, final EntityKey optionalObjectKey, final List<E> hydratedObjects, final EntityKey[] keys, boolean returnProxies)
|
| private Object | getRowFromResultSet(final ResultSet resultSet, final SharedSessionContractImplementor session, final QueryParameters queryParameters, final LockMode[] lockModesArray, final EntityKey optionalObjectKey, final List<E> hydratedObjects, final EntityKey[] keys, boolean returnProxies, ResultTransformer forcedResultTransformer)
|
| protected List | getRowsFromResultSet(ResultSet rs, QueryParameters queryParameters, SharedSessionContractImplementor session, boolean returnProxies, ResultTransformer forcedResultTransformer, int maxRows, List<Object> hydratedObjects, List<EntityKey[]> subselectResultKeys)
|
| private ScrollMode | |
| public abstract String | Returns: The sql command this loader should use to get itsResultSet.The SQL query string to be called; implemented by all subclasses |
| protected void | handleEmptyCollections(final Serializable[] keys, final Object resultSetId, final SharedSessionContractImplementor session)
If this is a collection initializer, we need to tell the session that a collection is being initialized, to account for the possibility of the collection having no elements (hence no rows in the result set). |
| protected boolean | |
| private void | hydrateEntityState(ResultSet rs, int i, Loadable persister, String rowIdAlias, EntityKey key, List<E> hydratedObjects, SharedSessionContractImplementor session, String instanceClass, Object object, LockMode acquiredLockMode)
|
| protected boolean[] | |
| private void | initializeEntitiesAndCollections(final List<E> hydratedObjects, final Object resultSetId, final SharedSessionContractImplementor session, final boolean readOnly)
|
| private void | initializeEntitiesAndCollections(final List<E> hydratedObjects, final Object resultSetId, final SharedSessionContractImplementor session, final boolean readOnly, List<AfterLoadAction> afterLoadActions)
|
| protected void | instanceAlreadyLoaded(final ResultSet rs, final int i, final Loadable persister, final EntityKey key, final Object object, final LockMode requestedLockMode, List<E> hydratedObjects, final SharedSessionContractImplementor session)
The entity instance is already in the session cache |
| protected Object | instanceNotYetLoaded(final ResultSet rs, final int i, final Loadable persister, final String rowIdAlias, final EntityKey key, final LockMode lockMode, final EntityKey optionalObjectKey, final Object optionalObject, final List<E> hydratedObjects, final SharedSessionContractImplementor session)
The entity instance is not in the session cache |
| private boolean | |
| private boolean | isCurrentRowForSameEntity(final EntityKey keyToRead, final int persisterIndex, final ResultSet resultSet, final SharedSessionContractImplementor session)
|
| protected boolean | |
| protected boolean | |
| private boolean | |
| protected List | list(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final Set<Serializable> querySpaces, final Type[] resultTypes)
Return the query results, using the query cache, called by subclasses that implement cacheable queries |
| private List | |
| private List | listUsingQueryCache(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final Set<Serializable> querySpaces, final Type[] resultTypes)
|
| public final void | loadCollection(final SharedSessionContractImplementor session, final Serializable id, final Type type)
Called by subclasses that initialize collections |
| public final void | loadCollectionBatch(final SharedSessionContractImplementor session, final Serializable[] ids, final Type type)
Called by wrappers that batch initialize collections |
| protected final void | loadCollectionSubselect(final SharedSessionContractImplementor session, final Serializable[] ids, final Object[] parameterValues, final Type[] parameterTypes, final Map<String, TypedValue> namedParameters, final Type type)
Called by subclasses that batch initialize collections |
| protected final List | loadEntity(final SharedSessionContractImplementor session, final Object id, final Type identifierType, final Object optionalObject, final String optionalEntityName, final Serializable optionalIdentifier, final EntityPersister persister, final LockOptions lockOptions, final Boolean readOnly)
Called by subclasses that load entities |
| protected final List | loadEntity(final SharedSessionContractImplementor session, final Object key, final Object index, final Type keyType, final Type indexType, final EntityPersister
only needed for logging persister)Called by subclasses that load entities |
| public final List | loadEntityBatch(final SharedSessionContractImplementor session, final Serializable[] ids, final Type idType, final Object optionalObject, final String optionalEntityName, final Serializable optionalId, final EntityPersister persister, LockOptions lockOptions)
Called by wrappers that batch load entities |
| public final List | loadEntityBatch(final SharedSessionContractImplementor session, final Serializable[] ids, final Type idType, final Object optionalObject, final String optionalEntityName, final Serializable optionalId, final EntityPersister persister, final LockOptions lockOptions, final Boolean readOnly)
Called by wrappers that batch load entities |
| private void | loadFromResultSet(final ResultSet rs, final int i, final Object object, final String instanceEntityName, final EntityKey key, final String rowIdAlias, final LockMode lockMode, final Loadable rootPersister, final SharedSessionContractImplementor session)
Hydrate the state an object from the SQL ResultSet, into an array or "hydrated" values (do not resolve associations yet), and pass the hydrates state to the session. |
| public Object | Returns: The loaded "row".The result set from which to do the load. resultSet, final SharedSessionContractImplementor The session from which the request originated. session, final QueryParameters The query parameters specified by the user. queryParameters, final boolean Should proxies be generated returnProxies)Loads a single logical row from the result set moving forward. |
| public Object | Returns: The loaded "row".The result set from which to do the load. resultSet, final SharedSessionContractImplementor The session from which the request originated. session, final QueryParameters The query parameters specified by the user. queryParameters, final boolean Should proxies be generated returnProxies, final boolean isLogicallyAfterLast)Loads a single logical row from the result set moving forward. |
| public Object | Returns: The loaded "row".The result set from which to do the load. resultSet, final SharedSessionContractImplementor The session from which the request originated. session, final QueryParameters The query parameters specified by the user. queryParameters, final boolean Should proxies be generated returnProxies)Loads a single row from the result set. |
| protected boolean | Returns: True if it does, and thus needs the special fetching scroll functionality; false otherwise.Does the result set to be scrolled contain collection fetches? |
| protected void | |
| protected final PreparedStatement | prepareQueryStatement(String sql, final QueryParameters queryParameters, final LimitHandler limitHandler, final boolean scroll, final SharedSessionContractImplementor session)
Obtain a PreparedStatement with all parameters pre-bound. |
| protected ResultSet | preprocessResultSet(ResultSet rs, final RowSelection selection, final LimitHandler limitHandler, final boolean autodiscovertypes, final SharedSessionContractImplementor session)
|
| protected String | preprocessSQL(String sql, QueryParameters parameters, SessionFactoryImplementor sessionFactory, List<AfterLoadAction> afterLoadActions)
Deprecated
as a consequence of
Modify the SQL, adding lock hints and comments, if necessary
SessionFactoryImplementor being deprecated.
|
| protected String | Returns: SQL stringSQL string sql, QueryParameters SQL parameters parameters)Remove distinct keyword from SQL statement if the query should not pass it through. |
| protected List | processResultSet(ResultSet rs, QueryParameters queryParameters, SharedSessionContractImplementor session, boolean returnProxies, ResultTransformer forcedResultTransformer, int maxRows, List<AfterLoadAction> afterLoadActions)
|
| protected void | putResultInQueryCache(final SharedSessionContractImplementor session, final QueryParameters queryParameters, final Type[] resultTypes, final QueryResultsCache queryCache, final QueryKey key, final List<E> result)
Deprecated
as a consequence of
QueryResultsCache being deprecated.
|
| private void | readCollectionElement(final Object optionalOwner, final Serializable optionalKey, final CollectionPersister persister, final CollectionAliases descriptor, final ResultSet rs, final SharedSessionContractImplementor session)
Read one collection element from the current row of the JDBC result set |
| private void | readCollectionElements(Object[] row, ResultSet resultSet, SharedSessionContractImplementor session)
Read any collection elements contained in a single row of the result set |
| protected void | registerNonExists(final EntityKey[] keys, final Loadable[] persisters, final SharedSessionContractImplementor session)
For missing objects associated by one-to-one with another object in the result set, register the fact that the the object is missing with the session. |
| protected ResultTransformer | Returns: the actual result transformerthe specified result transformer resultTransformer)Determine the actual ResultTransformer that will be used to transform query results. |
| private ColumnNameCache | retrieveColumnNameToIndexCache(final ResultSet rs)
Deprecated
as a consequence of
ColumnNameCache being deprecated.
|
| protected ScrollableResultsImplementor | Returns: The ScrollableResults instance.The parameters with which the query should be executed. queryParameters, final Type[] The expected return types of the query returnTypes, final HolderInstantiator If the return values are expected to be wrapped
in a holder, this is the thing that knows how to wrap them. holderInstantiator, final SharedSessionContractImplementor The session from which the scroll request originated. session)Return the query results, as an instance of ScrollableResults |
| private Object | sequentialLoad(final ResultSet resultSet, final SharedSessionContractImplementor session, final QueryParameters queryParameters, final boolean returnProxies, final EntityKey keyToRead)
|
| protected boolean | shouldUseFollowOnLocking(QueryParameters parameters, Dialect dialect, List<AfterLoadAction> afterLoadActions)
|
| public String | |
| private static Set | |
| protected boolean | upgradeLocks()
Does this query return objects that might be already cached by the session, whose lock mode may need upgrading |
| private ResultSet |