org.hibernate.persister.entity.Loadable
| Modifier and Type | Field and Description |
|---|---|
| private ColumnNameCache | |
| private final SessionFactoryImplementor | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public |
| 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, LockOptions lockOptions, Dialect dialect)
Append FOR UPDATE OF clause, if necessary. |
| protected void | |
| protected boolean | Returns: true, if getResultColumnOrRow() transforms the results; false, otherwisethe specified transformer transformer)Are rows transformed immediately after being read from the ResultSet? |
| protected void | |
| private int | Returns: The number of parameter values bound.The statement to which to bind limit param values. statement, final int The bind position from which to start binding index, final RowSelection The selection object containing the limit information. selection)Bind parameter values needed by the dialect-specific LIMIT clause. |
| protected int | Returns: The number of JDBC bind positions actually bound during this method execution.The JDBC prepared statement statement, final Map<K, V> A map of parameter names to values namedParams, final int The position from which to start binding parameter values. startIndex, final SessionImplementor 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, SessionImplementor 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 SessionImplementor The originating session. session)Bind positional parameter values to the JDBC prepared statement. |
| private Map | |
| protected void | |
| private void | checkVersion(final int i, final Loadable persister, final Serializable id, final Object entity, final ResultSet rs, final SessionImplementor 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 |
| private void | |
| private Serializable | determineResultId(SessionImplementor session, Serializable optionalId, Type idType, Serializable resolvedId)
|
| protected List | doList(final SessionImplementor session, final QueryParameters queryParameters)
Actually execute a query, ignoring the query cache |
| private List | doQuery(final SessionImplementor session, final QueryParameters queryParameters, final boolean returnProxies)
|
| private List | doQueryAndInitializeNonLazyCollections(final SessionImplementor 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. |
| private void | endCollectionLoad(final Object resultSetId, final SessionImplementor session, final CollectionPersister collectionPersister)
|
| protected void | extractKeysFromResultSet(Loadable[] persisters, QueryParameters queryParameters, ResultSet resultSet, SessionImplementor session, EntityKey[] keys, LockMode[] lockModes, List<E> hydratedObjects)
|
| 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 whether the entities have eager property fetching enabled. |
| private 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 static int | |
| private String | getInstanceClass(final ResultSet rs, final int i, final Loadable persister, final Serializable id, final SessionImplementor 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 SessionImplementor session)
Read a row of Keys from the ResultSet into the given array. |
| 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? |
| private static int | Returns: The appropriate value to bind into the limit clause.The selection criteria selection, final Dialect The dialect dialect)Some dialect-specific LIMIT clauses require the maximum last row number (aka, first_row_number + total_row_count), while others require the maximum returned row count (the total maximum number of rows to return). |
| public int[] | |
| private 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"). |
| 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, SessionImplementor session)
Get the actual object that is returned in the user-visible result list. |
| private List | getResultFromQueryCache(final SessionImplementor session, final QueryParameters queryParameters, final Set<E> querySpaces, final Type[] resultTypes, final QueryCache queryCache, final QueryKey key)
|
| protected List | |
| protected final ResultSet | getResultSet(final PreparedStatement st, final boolean autodiscovertypes, final boolean callable, final RowSelection selection, final SessionImplementor session)
Fetch a PreparedStatement, call setMaxRows and then execute it, advance to the first result and return an 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 SessionImplementor 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 SessionImplementor session, final QueryParameters queryParameters, final LockMode[] lockModesArray, final EntityKey optionalObjectKey, final List<E> hydratedObjects, final EntityKey[] keys, boolean returnProxies)
|
| protected abstract String | Returns: The sql command this loader should use to get itsResultSet.The SQL query string to be called; implemented by all subclasses |
| private void | handleEmptyCollections(final Serializable[] keys, final Object resultSetId, final SessionImplementor 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). |
| private static boolean | |
| protected boolean | |
| private void | initializeEntitiesAndCollections(final List<E> hydratedObjects, final Object resultSetId, final SessionImplementor session, final boolean readOnly)
|
| private void | instanceAlreadyLoaded(final ResultSet rs, final int i, final Loadable persister, final EntityKey key, final Object object, final LockMode lockMode, final SessionImplementor session)
The entity instance is already in the session cache |
| private 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 SessionImplementor session)
The entity instance is not in the session cache |
| private int | |
| private boolean | |
| protected boolean | |
| protected boolean | |
| protected List | list(final SessionImplementor session, final QueryParameters queryParameters, final Set<E> 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 SessionImplementor session, final QueryParameters queryParameters, final Set<E> querySpaces, final Type[] resultTypes)
|
| public final void | loadCollection(final SessionImplementor session, final Serializable id, final Type type)
Called by subclasses that initialize collections |
| public final void | loadCollectionBatch(final SessionImplementor session, final Serializable[] ids, final Type type)
Called by wrappers that batch initialize collections |
| protected final void | loadCollectionSubselect(final SessionImplementor session, final Serializable[] ids, final Object[] parameterValues, final Type[] parameterTypes, final Map<K, V> namedParameters, final Type type)
Called by subclasses that batch initialize collections |
| protected final List | loadEntity(final SessionImplementor session, final Object id, final Type identifierType, final Object optionalObject, final String optionalEntityName, final Serializable optionalIdentifier, final EntityPersister
only needed for logging persister, LockOptions lockOptions)Called by subclasses that load entities |
| protected final List | loadEntity(final SessionImplementor 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 SessionImplementor session, final Serializable[] ids, final Type idType, final Object optionalObject, final String optionalEntityName, final Serializable optionalId, final EntityPersister
only needed for logging persister, LockOptions lockOptions)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 SessionImplementor 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 SessionImplementor 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 SessionImplementor 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 SessionImplementor 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. |
| private void | |
| 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(final QueryParameters queryParameters, final boolean scroll, final SessionImplementor session)
Obtain a PreparedStatement with all parameters pre-bound. |
| private String | |
| protected String | preprocessSQL(String sql, QueryParameters parameters, Dialect dialect)
Modify the SQL, adding lock hints and comments, if necessary |
| private void | putResultInQueryCache(final SessionImplementor session, final QueryParameters queryParameters, final Type[] resultTypes, final QueryCache queryCache, final QueryKey key, final List<E> result)
|
| private void | readCollectionElement(final Object optionalOwner, final Serializable optionalKey, final CollectionPersister persister, final CollectionAliases descriptor, final ResultSet rs, final SessionImplementor session)
Read one collection element from the current row of the JDBC result set |
| private void | readCollectionElements(Object[] row, ResultSet resultSet, SessionImplementor session)
Read any collection elements contained in a single row of the result set |
| private void | registerNonExists(final EntityKey[] keys, final Loadable[] persisters, final SessionImplementor 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 | |
| protected ScrollableResults | 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 SessionImplementor 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 SessionImplementor session, final QueryParameters queryParameters, final boolean returnProxies, final EntityKey keyToRead)
|
| private void | setMaxRows(final PreparedStatement st, final RowSelection selection)
Use JDBC API to limit the number of rows returned by the SQL query if necessary |
| 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 static boolean | useLimit(final RowSelection selection, final Dialect dialect)
Should we pre-process the SQL string, adding a dialect-specific LIMIT clause. |
| private synchronized ResultSet |