HHH-9790 - Remove deprecated methods from Session and SessionFactory

This commit is contained in:
Steve Ebersole 2015-05-13 11:55:02 -05:00
parent b8f43a8c12
commit b605c3534e
9 changed files with 204 additions and 186 deletions

View File

@ -30,6 +30,7 @@ import org.hibernate.bytecode.instrumentation.spi.FieldInterceptor;
import org.hibernate.collection.spi.PersistentCollection;
import org.hibernate.engine.HibernateIterator;
import org.hibernate.engine.jdbc.LobCreator;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
@ -137,7 +138,8 @@ public final class Hibernate {
*/
public static LobCreator getLobCreator(SessionImplementor session) {
return session.getFactory()
.getJdbcServices()
.getServiceRegistry()
.getService( JdbcServices.class )
.getLobCreator( session );
}

View File

@ -95,7 +95,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return The session builder
*/
public SharedSessionBuilder sessionWithOptions();
SharedSessionBuilder sessionWithOptions();
/**
* Force this session to flush. Must be called at the end of a
@ -109,7 +109,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @throws HibernateException Indicates problems flushing the session or
* talking to the database.
*/
public void flush() throws HibernateException;
void flush() throws HibernateException;
/**
* Set the flush mode for this session.
@ -125,14 +125,14 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param flushMode the new flush mode
* @see FlushMode
*/
public void setFlushMode(FlushMode flushMode);
void setFlushMode(FlushMode flushMode);
/**
* Get the current flush mode for this session.
*
* @return The flush mode
*/
public FlushMode getFlushMode();
FlushMode getFlushMode();
/**
* Set the cache mode.
@ -142,14 +142,14 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @param cacheMode The new cache mode.
*/
public void setCacheMode(CacheMode cacheMode);
void setCacheMode(CacheMode cacheMode);
/**
* Get the current cache mode.
*
* @return The current cache mode.
*/
public CacheMode getCacheMode();
CacheMode getCacheMode();
/**
* Get the session factory which created this session.
@ -157,7 +157,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @return The session factory.
* @see SessionFactory
*/
public SessionFactory getSessionFactory();
SessionFactory getSessionFactory();
/**
* End the session by releasing the JDBC connection and cleaning up. It is
@ -166,7 +166,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException Indicates problems cleaning up.
*/
public void close() throws HibernateException;
void close() throws HibernateException;
/**
* Cancel the execution of the current query.
@ -176,21 +176,21 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException There was a problem canceling the query
*/
public void cancelQuery() throws HibernateException;
void cancelQuery() throws HibernateException;
/**
* Check if the session is still open.
*
* @return boolean
*/
public boolean isOpen();
boolean isOpen();
/**
* Check if the session is currently connected.
*
* @return boolean
*/
public boolean isConnected();
boolean isConnected();
/**
* Does this session contain any changes which must be synchronized with
@ -200,7 +200,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @return True if the session contains pending changes; false otherwise.
* @throws HibernateException could not perform dirtying checking
*/
public boolean isDirty() throws HibernateException;
boolean isDirty() throws HibernateException;
/**
* Will entities and proxies that are loaded into this session be made
@ -213,7 +213,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @return true, loaded entities/proxies will be made read-only by default;
* false, loaded entities/proxies will be made modifiable by default.
*/
public boolean isDefaultReadOnly();
boolean isDefaultReadOnly();
/**
* Change the default for entities and proxies loaded into this session
@ -238,7 +238,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param readOnly true, the default for loaded entities/proxies is read-only;
* false, the default for loaded entities/proxies is modifiable
*/
public void setDefaultReadOnly(boolean readOnly);
void setDefaultReadOnly(boolean readOnly);
/**
* Return the identifier value of the given entity as associated with this
@ -250,7 +250,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @throws TransientObjectException if the instance is transient or associated with
* a different session
*/
public Serializable getIdentifier(Object object);
Serializable getIdentifier(Object object);
/**
* Check if this instance is associated with this <tt>Session</tt>.
@ -258,7 +258,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param object an instance of a persistent class
* @return true if the given instance is associated with this <tt>Session</tt>
*/
public boolean contains(Object object);
boolean contains(Object object);
/**
* Remove this instance from the session cache. Changes to the instance will
@ -270,7 +270,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @throws NullPointerException if the passed object is {@code null}
* @throws IllegalArgumentException if the passed object is not defined as an entity
*/
public void evict(Object object);
void evict(Object object);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -286,7 +286,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see #load(Class, Serializable, LockOptions)
*/
public <T> T load(Class<T> theClass, Serializable id, LockMode lockMode);
<T> T load(Class<T> theClass, Serializable id, LockMode lockMode);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -297,7 +297,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param lockOptions contains the lock level
* @return the persistent instance or proxy
*/
public <T> T load(Class<T> theClass, Serializable id, LockOptions lockOptions);
<T> T load(Class<T> theClass, Serializable id, LockOptions lockOptions);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -313,7 +313,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see #load(String, Serializable, LockOptions)
*/
public Object load(String entityName, Serializable id, LockMode lockMode);
Object load(String entityName, Serializable id, LockMode lockMode);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -325,7 +325,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the persistent instance or proxy
*/
public Object load(String entityName, Serializable id, LockOptions lockOptions);
Object load(String entityName, Serializable id, LockOptions lockOptions);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -341,7 +341,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the persistent instance or proxy
*/
public <T> T load(Class<T> theClass, Serializable id);
<T> T load(Class<T> theClass, Serializable id);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -357,7 +357,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the persistent instance or proxy
*/
public Object load(String entityName, Serializable id);
Object load(String entityName, Serializable id);
/**
* Read the persistent state associated with the given identifier into the given transient
@ -366,7 +366,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param object an "empty" instance of the persistent class
* @param id a valid identifier of an existing persistent instance of the class
*/
public void load(Object object, Serializable id);
void load(Object object, Serializable id);
/**
* Persist the state of the given detached instance, reusing the current
@ -376,7 +376,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param object a detached instance of a persistent class
* @param replicationMode The replication mode to use
*/
public void replicate(Object object, ReplicationMode replicationMode);
void replicate(Object object, ReplicationMode replicationMode);
/**
* Persist the state of the given detached instance, reusing the current
@ -387,7 +387,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param object a detached instance of a persistent class
* @param replicationMode The replication mode to use
*/
public void replicate(String entityName, Object object, ReplicationMode replicationMode) ;
void replicate(String entityName, Object object, ReplicationMode replicationMode) ;
/**
* Persist the given transient instance, first assigning a generated identifier. (Or
@ -399,7 +399,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the generated identifier
*/
public Serializable save(Object object);
Serializable save(Object object);
/**
* Persist the given transient instance, first assigning a generated identifier. (Or
@ -412,7 +412,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the generated identifier
*/
public Serializable save(String entityName, Object object);
Serializable save(String entityName, Object object);
/**
* Either {@link #save(Object)} or {@link #update(Object)} the given
@ -427,7 +427,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @see Session#save(java.lang.Object)
* @see Session#update(Object object)
*/
public void saveOrUpdate(Object object);
void saveOrUpdate(Object object);
/**
* Either {@link #save(String, Object)} or {@link #update(String, Object)}
@ -443,7 +443,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @see Session#save(String,Object)
* @see Session#update(String,Object)
*/
public void saveOrUpdate(String entityName, Object object);
void saveOrUpdate(String entityName, Object object);
/**
* Update the persistent instance with the identifier of the given detached
@ -453,7 +453,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @param object a detached instance containing updated state
*/
public void update(Object object);
void update(Object object);
/**
* Update the persistent instance with the identifier of the given detached
@ -464,7 +464,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param entityName The entity name
* @param object a detached instance containing updated state
*/
public void update(String entityName, Object object);
void update(String entityName, Object object);
/**
* Copy the state of the given object onto the persistent object with the same
@ -481,7 +481,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return an updated persistent instance
*/
public Object merge(Object object);
Object merge(Object object);
/**
* Copy the state of the given object onto the persistent object with the same
@ -499,7 +499,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return an updated persistent instance
*/
public Object merge(String entityName, Object object);
Object merge(String entityName, Object object);
/**
* Make a transient instance persistent. This operation cascades to associated
@ -509,7 +509,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @param object a transient instance to be made persistent
*/
public void persist(Object object);
void persist(Object object);
/**
* Make a transient instance persistent. This operation cascades to associated
* instances if the association is mapped with {@code cascade="persist"}
@ -519,7 +519,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param entityName The entity name
* @param object a transient instance to be made persistent
*/
public void persist(String entityName, Object object);
void persist(String entityName, Object object);
/**
* Remove a persistent instance from the datastore. The argument may be
@ -530,7 +530,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @param object the instance to be removed
*/
public void delete(Object object);
void delete(Object object);
/**
* Remove a persistent instance from the datastore. The <b>object</b> argument may be
@ -542,7 +542,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param entityName The entity name for the instance to be removed.
* @param object the instance to be removed
*/
public void delete(String entityName, Object object);
void delete(String entityName, Object object);
/**
* Obtain the specified lock level upon the given object. This may be used to
@ -559,7 +559,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @see #buildLockRequest(LockOptions)
* @see LockRequest#lock(Object)
*/
public void lock(Object object, LockMode lockMode);
void lock(Object object, LockMode lockMode);
/**
* Obtain the specified lock level upon the given object. This may be used to
@ -577,7 +577,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @see #buildLockRequest(LockOptions)
* @see LockRequest#lock(String, Object)
*/
public void lock(String entityName, Object object, LockMode lockMode);
void lock(String entityName, Object object, LockMode lockMode);
/**
* Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.
@ -591,7 +591,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return a lockRequest that can be used to lock the passed object.
*/
public LockRequest buildLockRequest(LockOptions lockOptions);
LockRequest buildLockRequest(LockOptions lockOptions);
/**
* Re-read the state of the given instance from the underlying database. It is
@ -606,7 +606,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @param object a persistent or detached instance
*/
public void refresh(Object object);
void refresh(Object object);
/**
* Re-read the state of the given instance from the underlying database. It is
@ -622,7 +622,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param entityName a persistent class
* @param object a persistent or detached instance
*/
public void refresh(String entityName, Object object);
void refresh(String entityName, Object object);
/**
* Re-read the state of the given instance from the underlying database, with
@ -637,7 +637,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see #refresh(Object, LockOptions)
*/
public void refresh(Object object, LockMode lockMode);
void refresh(Object object, LockMode lockMode);
/**
* Re-read the state of the given instance from the underlying database, with
@ -648,7 +648,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param object a persistent or detached instance
* @param lockOptions contains the lock mode to use
*/
public void refresh(Object object, LockOptions lockOptions);
void refresh(Object object, LockOptions lockOptions);
/**
* Re-read the state of the given instance from the underlying database, with
@ -660,7 +660,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param object a persistent or detached instance
* @param lockOptions contains the lock mode to use
*/
public void refresh(String entityName, Object object, LockOptions lockOptions);
void refresh(String entityName, Object object, LockOptions lockOptions);
/**
* Determine the current lock mode of the given object.
@ -669,7 +669,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the current lock mode
*/
public LockMode getCurrentLockMode(Object object);
LockMode getCurrentLockMode(Object object);
/**
* Create a {@link Query} instance for the given collection and filter string. Contains an implicit {@code FROM}
@ -681,14 +681,14 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return The query instance for manipulation and execution
*/
public Query createFilter(Object collection, String queryString);
Query createFilter(Object collection, String queryString);
/**
* Completely clear the session. Evict all loaded instances and cancel all pending
* saves, updates and deletions. Do not close open iterators or instances of
* <tt>ScrollableResults</tt>.
*/
public void clear();
void clear();
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -700,7 +700,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return a persistent instance or null
*/
public <T> T get(Class<T> entityType, Serializable id);
<T> T get(Class<T> entityType, Serializable id);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -718,7 +718,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see #get(Class, Serializable, LockOptions)
*/
public <T> T get(Class<T> entityType, Serializable id, LockMode lockMode);
<T> T get(Class<T> entityType, Serializable id, LockMode lockMode);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -732,7 +732,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return a persistent instance or null
*/
public <T> T get(Class<T> entityType, Serializable id, LockOptions lockOptions);
<T> T get(Class<T> entityType, Serializable id, LockOptions lockOptions);
/**
* Return the persistent instance of the given named entity with the given identifier,
@ -744,7 +744,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return a persistent instance or null
*/
public Object get(String entityName, Serializable id);
Object get(String entityName, Serializable id);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -762,7 +762,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see #get(String, Serializable, LockOptions)
*/
public Object get(String entityName, Serializable id, LockMode lockMode);
Object get(String entityName, Serializable id, LockMode lockMode);
/**
* Return the persistent instance of the given entity class with the given identifier,
@ -776,7 +776,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return a persistent instance or null
*/
public Object get(String entityName, Serializable id, LockOptions lockOptions);
Object get(String entityName, Serializable id, LockOptions lockOptions);
/**
* Return the entity name for a persistent entity.
@ -785,7 +785,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return the entity name
*/
public String getEntityName(Object object);
String getEntityName(Object object);
/**
* Create an {@link IdentifierLoadAccess} instance to retrieve the specified entity type by
@ -797,7 +797,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException If the specified entity name cannot be resolved as an entity name
*/
public IdentifierLoadAccess byId(String entityName);
IdentifierLoadAccess byId(String entityName);
/**
* Create an {@link IdentifierLoadAccess} instance to retrieve the specified entity by
@ -809,7 +809,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException If the specified Class cannot be resolved as a mapped entity
*/
public <T> IdentifierLoadAccess<T> byId(Class<T> entityClass);
<T> IdentifierLoadAccess<T> byId(Class<T> entityClass);
/**
* Create an {@link NaturalIdLoadAccess} instance to retrieve the specified entity by
@ -821,7 +821,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException If the specified entity name cannot be resolved as an entity name
*/
public NaturalIdLoadAccess byNaturalId(String entityName);
NaturalIdLoadAccess byNaturalId(String entityName);
/**
* Create an {@link NaturalIdLoadAccess} instance to retrieve the specified entity by
@ -833,7 +833,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException If the specified Class cannot be resolved as a mapped entity
*/
public <T> NaturalIdLoadAccess<T> byNaturalId(Class<T> entityClass);
<T> NaturalIdLoadAccess<T> byNaturalId(Class<T> entityClass);
/**
* Create an {@link SimpleNaturalIdLoadAccess} instance to retrieve the specified entity by
@ -846,7 +846,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @throws HibernateException If the specified entityClass cannot be resolved as a mapped entity, or if the
* entity does not define a natural-id or if its natural-id is made up of multiple attributes.
*/
public SimpleNaturalIdLoadAccess bySimpleNaturalId(String entityName);
SimpleNaturalIdLoadAccess bySimpleNaturalId(String entityName);
/**
* Create an {@link SimpleNaturalIdLoadAccess} instance to retrieve the specified entity by
@ -859,7 +859,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @throws HibernateException If the specified entityClass cannot be resolved as a mapped entity, or if the
* entity does not define a natural-id or if its natural-id is made up of multiple attributes.
*/
public <T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId(Class<T> entityClass);
<T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId(Class<T> entityClass);
/**
* Enable the named filter for this current session.
@ -868,7 +868,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return The Filter instance representing the enabled filter.
*/
public Filter enableFilter(String filterName);
Filter enableFilter(String filterName);
/**
* Retrieve a currently enabled filter by name.
@ -877,21 +877,21 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return The Filter instance representing the enabled filter.
*/
public Filter getEnabledFilter(String filterName);
Filter getEnabledFilter(String filterName);
/**
* Disable the named filter for the current session.
*
* @param filterName The name of the filter to be disabled.
*/
public void disableFilter(String filterName);
void disableFilter(String filterName);
/**
* Get the statistics for this session.
*
* @return The session statistics being collected for this session
*/
public SessionStatistics getStatistics();
SessionStatistics getStatistics();
/**
* Is the specified entity or proxy read-only?
@ -903,7 +903,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param entityOrProxy an entity or HibernateProxy
* @return {@code true} if the entity or proxy is read-only, {@code false} if the entity or proxy is modifiable.
*/
public boolean isReadOnly(Object entityOrProxy);
boolean isReadOnly(Object entityOrProxy);
/**
* Set an unmodified persistent object to read-only mode, or a read-only
@ -925,7 +925,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param readOnly {@code true} if the entity or proxy should be made read-only; {@code false} if the entity or
* proxy should be made modifiable
*/
public void setReadOnly(Object entityOrProxy, boolean readOnly);
void setReadOnly(Object entityOrProxy, boolean readOnly);
/**
* Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
@ -933,7 +933,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
* @param work The work to be performed.
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
*/
public void doWork(Work work) throws HibernateException;
void doWork(Work work) throws HibernateException;
/**
* Controller for allowing users to perform JDBC related work using the Connection managed by this Session. After
@ -946,7 +946,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @throws HibernateException Generally indicates wrapped {@link java.sql.SQLException}
*/
public <T> T doReturningWork(ReturningWork<T> work) throws HibernateException;
<T> T doReturningWork(ReturningWork<T> work) throws HibernateException;
/**
* Disconnect the session from its underlying JDBC connection. This is intended for use in cases where the
@ -983,7 +983,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see org.hibernate.engine.profile.FetchProfile for discussion of this feature
*/
public boolean isFetchProfileEnabled(String name) throws UnknownProfileException;
boolean isFetchProfileEnabled(String name) throws UnknownProfileException;
/**
* Enable a particular fetch profile on this session. No-op if requested
@ -995,7 +995,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see org.hibernate.engine.profile.FetchProfile for discussion of this feature
*/
public void enableFetchProfile(String name) throws UnknownProfileException;
void enableFetchProfile(String name) throws UnknownProfileException;
/**
* Disable a particular fetch profile on this session. No-op if requested
@ -1007,7 +1007,7 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @see org.hibernate.engine.profile.FetchProfile for discussion of this feature
*/
public void disableFetchProfile(String name) throws UnknownProfileException;
void disableFetchProfile(String name) throws UnknownProfileException;
/**
* Convenience access to the {@link TypeHelper} associated with this session's {@link SessionFactory}.
@ -1016,29 +1016,29 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @return The {@link TypeHelper} associated with this session's {@link SessionFactory}
*/
public TypeHelper getTypeHelper();
TypeHelper getTypeHelper();
/**
* Retrieve this session's helper/delegate for creating LOB instances.
*
* @return This session's LOB helper
*/
public LobHelper getLobHelper();
LobHelper getLobHelper();
/**
* Contains locking details (LockMode, Timeout and Scope).
*/
public interface LockRequest {
interface LockRequest {
/**
* Constant usable as a time out value that indicates no wait semantics should be used in
* attempting to acquire locks.
*/
static final int PESSIMISTIC_NO_WAIT = 0;
int PESSIMISTIC_NO_WAIT = 0;
/**
* Constant usable as a time out value that indicates that attempting to acquire locks should be allowed to
* wait forever (apply no timeout).
*/
static final int PESSIMISTIC_WAIT_FOREVER = -1;
int PESSIMISTIC_WAIT_FOREVER = -1;
/**
* Get the lock mode.
@ -1111,5 +1111,5 @@ public interface Session extends SharedSessionContract, java.io.Closeable {
*
* @param listeners The listener(s) to add
*/
public void addEventListeners(SessionEventListener... listeners);
void addEventListeners(SessionEventListener... listeners);
}

View File

@ -72,6 +72,7 @@ import org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver;
import org.hibernate.engine.jdbc.env.spi.AnsiSqlKeywords;
import org.hibernate.engine.jdbc.env.spi.NameQualifierSupport;
import org.hibernate.engine.jdbc.env.spi.SchemaNameResolver;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.exception.spi.ConversionContext;
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
@ -592,7 +593,9 @@ public abstract class Dialect implements ConversionContext {
return null;
}
try {
final LobCreator lobCreator = session.getFactory().getJdbcServices().getLobCreator( session );
final LobCreator lobCreator = session.getFactory().getServiceRegistry().getService( JdbcServices.class ).getLobCreator(
session
);
return original == null
? lobCreator.createBlob( ArrayHelper.EMPTY_BYTE_ARRAY )
: lobCreator.createBlob( original.getBinaryStream(), original.length() );
@ -608,7 +611,7 @@ public abstract class Dialect implements ConversionContext {
return null;
}
try {
final LobCreator lobCreator = session.getFactory().getJdbcServices().getLobCreator( session );
final LobCreator lobCreator = session.getFactory().getServiceRegistry().getService( JdbcServices.class ).getLobCreator( session );
return original == null
? lobCreator.createClob( "" )
: lobCreator.createClob( original.getCharacterStream(), original.length() );
@ -624,7 +627,7 @@ public abstract class Dialect implements ConversionContext {
return null;
}
try {
final LobCreator lobCreator = session.getFactory().getJdbcServices().getLobCreator( session );
final LobCreator lobCreator = session.getFactory().getServiceRegistry().getService( JdbcServices.class ).getLobCreator( session );
return original == null
? lobCreator.createNClob( "" )
: lobCreator.createNClob( original.getCharacterStream(), original.length() );

View File

@ -43,7 +43,6 @@ import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.function.SQLFunctionRegistry;
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
import org.hibernate.engine.profile.FetchProfile;
@ -69,21 +68,21 @@ import org.hibernate.type.TypeResolver;
*/
public interface SessionFactoryImplementor extends Mapping, SessionFactory {
@Override
public SessionBuilderImplementor withOptions();
SessionBuilderImplementor withOptions();
/**
* Retrieve the {@link Type} resolver associated with this factory.
*
* @return The type resolver
*/
public TypeResolver getTypeResolver();
TypeResolver getTypeResolver();
/**
* Get a copy of the Properties used to configure this session factory.
*
* @return The properties.
*/
public Properties getProperties();
Properties getProperties();
/**
* Get the persister for the named entity
@ -92,14 +91,14 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* @return The persister
* @throws MappingException Indicates persister could not be found with that name.
*/
public EntityPersister getEntityPersister(String entityName) throws MappingException;
EntityPersister getEntityPersister(String entityName) throws MappingException;
/**
* Get all entity persisters as a Map, which entity name its the key and the persister is the value.
*
* @return The Map contains all entity persisters.
*/
public Map<String,EntityPersister> getEntityPersisters();
Map<String,EntityPersister> getEntityPersisters();
/**
* Get the persister object for a collection role.
@ -109,20 +108,23 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* @return The persister
* @throws MappingException Indicates persister could not be found with that role.
*/
public CollectionPersister getCollectionPersister(String role) throws MappingException;
CollectionPersister getCollectionPersister(String role) throws MappingException;
/**
* Get all collection persisters as a Map, which collection role as the key and the persister is the value.
*
* @return The Map contains all collection persisters.
*/
public Map<String, CollectionPersister> getCollectionPersisters();
Map<String, CollectionPersister> getCollectionPersisters();
/**
* Get the JdbcServices.
*
* @return the JdbcServices
*
* @deprecated since 5.0; use {@link #getServiceRegistry()} instead to locate the JdbcServices
*/
public JdbcServices getJdbcServices();
JdbcServices getJdbcServices();
/**
* Get the SQL dialect.
@ -131,70 +133,70 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
*
* @return The dialect
*/
public Dialect getDialect();
Dialect getDialect();
/**
* Get the factory scoped interceptor for this factory.
*
* @return The factory scope interceptor, or null if none.
*/
public Interceptor getInterceptor();
Interceptor getInterceptor();
public QueryPlanCache getQueryPlanCache();
QueryPlanCache getQueryPlanCache();
/**
* Get the return types of a query
*/
public Type[] getReturnTypes(String queryString) throws HibernateException;
Type[] getReturnTypes(String queryString) throws HibernateException;
/**
* Get the return aliases of a query
*/
public String[] getReturnAliases(String queryString) throws HibernateException;
String[] getReturnAliases(String queryString) throws HibernateException;
/**
* Get the names of all persistent classes that implement/extend the given interface/class
*/
public String[] getImplementors(String className) throws MappingException;
String[] getImplementors(String className) throws MappingException;
/**
* Get a class name, using query language imports
*/
public String getImportedClassName(String name);
String getImportedClassName(String name);
/**
* Get the default query cache
*/
public QueryCache getQueryCache();
QueryCache getQueryCache();
/**
* Get a particular named query cache, or the default cache
* @param regionName the name of the cache region, or null for the default query cache
* @return the existing cache, or a newly created cache if none by that region name
*/
public QueryCache getQueryCache(String regionName) throws HibernateException;
QueryCache getQueryCache(String regionName) throws HibernateException;
/**
* Get the cache of table update timestamps
*/
public UpdateTimestampsCache getUpdateTimestampsCache();
UpdateTimestampsCache getUpdateTimestampsCache();
/**
* Statistics SPI
*/
public StatisticsImplementor getStatisticsImplementor();
StatisticsImplementor getStatisticsImplementor();
public NamedQueryDefinition getNamedQuery(String queryName);
NamedQueryDefinition getNamedQuery(String queryName);
public void registerNamedQueryDefinition(String name, NamedQueryDefinition definition);
void registerNamedQueryDefinition(String name, NamedQueryDefinition definition);
public NamedSQLQueryDefinition getNamedSQLQuery(String queryName);
NamedSQLQueryDefinition getNamedSQLQuery(String queryName);
public void registerNamedSQLQueryDefinition(String name, NamedSQLQueryDefinition definition);
void registerNamedSQLQueryDefinition(String name, NamedSQLQueryDefinition definition);
public ResultSetMappingDefinition getResultSetMapping(String name);
ResultSetMappingDefinition getResultSetMapping(String name);
/**
* Get the identifier generator for the hierarchy
*/
public IdentifierGenerator getIdentifierGenerator(String rootEntityName);
IdentifierGenerator getIdentifierGenerator(String rootEntityName);
/**
* Get a named second-level cache region
@ -202,7 +204,7 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* @param regionName The name of the region to retrieve.
* @return The region
*/
public Region getSecondLevelCacheRegion(String regionName);
Region getSecondLevelCacheRegion(String regionName);
/**
* Get a named naturalId cache region
@ -210,7 +212,7 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* @param regionName The name of the region to retrieve.
* @return The region
*/
public Region getNaturalIdCacheRegion(String regionName);
Region getNaturalIdCacheRegion(String regionName);
/**
* Get a map of all the second level cache regions currently maintained in
@ -219,7 +221,7 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
*
* @return The map of regions
*/
public Map getAllSecondLevelCacheRegions();
Map getAllSecondLevelCacheRegions();
/**
* Retrieves the SQLExceptionConverter in effect for this SessionFactory.
@ -230,7 +232,7 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* {@link SqlExceptionHelper#getSqlExceptionConverter()} instead as obtained from {@link #getServiceRegistry()}
*/
@Deprecated
public SQLExceptionConverter getSQLExceptionConverter();
SQLExceptionConverter getSQLExceptionConverter();
/**
* Retrieves the SqlExceptionHelper in effect for this SessionFactory.
@ -241,18 +243,19 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* obtained from {@link #getServiceRegistry()}
*/
@Deprecated
public SqlExceptionHelper getSQLExceptionHelper();
SqlExceptionHelper getSQLExceptionHelper();
/**
* @deprecated since 5.0; use {@link #getSessionFactoryOptions()} instead
*/
@Deprecated
public Settings getSettings();
@SuppressWarnings("deprecation")
Settings getSettings();
/**
* Get a nontransactional "current" session for Hibernate EntityManager
* Get a non-transactional "current" session for Hibernate EntityManager
*/
public Session openTemporarySession() throws HibernateException;
Session openTemporarySession() throws HibernateException;
/**
* Retrieves a set of all the collection roles in which the given entity
@ -261,11 +264,11 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* @param entityName The entity name for which to get the collection roles.
* @return set of all the collection roles in which the given entityName participates.
*/
public Set<String> getCollectionRolesByEntityParticipant(String entityName);
Set<String> getCollectionRolesByEntityParticipant(String entityName);
public EntityNotFoundDelegate getEntityNotFoundDelegate();
EntityNotFoundDelegate getEntityNotFoundDelegate();
public SQLFunctionRegistry getSqlFunctionRegistry();
SQLFunctionRegistry getSqlFunctionRegistry();
/**
* Retrieve fetch profile by name.
@ -273,22 +276,22 @@ public interface SessionFactoryImplementor extends Mapping, SessionFactory {
* @param name The name of the profile to retrieve.
* @return The profile definition
*/
public FetchProfile getFetchProfile(String name);
FetchProfile getFetchProfile(String name);
public ServiceRegistryImplementor getServiceRegistry();
ServiceRegistryImplementor getServiceRegistry();
public void addObserver(SessionFactoryObserver observer);
void addObserver(SessionFactoryObserver observer);
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy();
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy();
public CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver();
CurrentTenantIdentifierResolver getCurrentTenantIdentifierResolver();
/**
* Provides access to the named query repository
*
* @return The repository for named query definitions
*/
public NamedQueryRepository getNamedQueryRepository();
NamedQueryRepository getNamedQueryRepository();
Iterable<EntityNameResolver> iterateEntityNameResolvers();

View File

@ -64,14 +64,14 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*
* @return The tenant identifier of this session
*/
public String getTenantIdentifier();
String getTenantIdentifier();
/**
* Provides access to JDBC connections
*
* @return The contract for accessing JDBC connections.
*/
public JdbcConnectionAccess getJdbcConnectionAccess();
JdbcConnectionAccess getJdbcConnectionAccess();
/**
* Hide the changing requirements of entity key creation
@ -81,7 +81,7 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*
* @return The entity key
*/
public EntityKey generateEntityKey(Serializable id, EntityPersister persister);
EntityKey generateEntityKey(Serializable id, EntityPersister persister);
/**
* Hide the changing requirements of cache key creation.
@ -92,20 +92,20 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*
* @return The cache key
*/
public CacheKey generateCacheKey(Serializable id, final Type type, final String entityOrRoleName);
CacheKey generateCacheKey(Serializable id, final Type type, final String entityOrRoleName);
/**
* Retrieves the interceptor currently in use by this event source.
*
* @return The interceptor.
*/
public Interceptor getInterceptor();
Interceptor getInterceptor();
/**
* Enable/disable automatic cache clearing from after transaction
* completion (for EJB3)
*/
public void setAutoClear(boolean enabled);
void setAutoClear(boolean enabled);
/**
* Disable automatic transaction joining. The really only has any effect for CMT transactions. The default
@ -114,18 +114,18 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
* <p/>
* See javax.persistence.EntityManager#joinTransaction
*/
public void disableTransactionAutoJoin();
void disableTransactionAutoJoin();
/**
* Does this <tt>Session</tt> have an active Hibernate transaction
* or is there a JTA transaction in progress?
*/
public boolean isTransactionInProgress();
boolean isTransactionInProgress();
/**
* Initialize the collection (if not already initialized)
*/
public void initializeCollection(PersistentCollection collection, boolean writing)
void initializeCollection(PersistentCollection collection, boolean writing)
throws HibernateException;
/**
@ -140,59 +140,59 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
* <p/>
* When <tt>eager</tt> is enabled, the object is eagerly fetched
*/
public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable)
Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable)
throws HibernateException;
/**
* Load an instance immediately. This method is only called when lazily initializing a proxy.
* Do not return the proxy.
*/
public Object immediateLoad(String entityName, Serializable id) throws HibernateException;
Object immediateLoad(String entityName, Serializable id) throws HibernateException;
/**
* System time before the start of the transaction
*/
public long getTimestamp();
long getTimestamp();
/**
* Get the creating <tt>SessionFactoryImplementor</tt>
*/
public SessionFactoryImplementor getFactory();
SessionFactoryImplementor getFactory();
/**
* Execute a <tt>find()</tt> query
*/
public List list(String query, QueryParameters queryParameters) throws HibernateException;
List list(String query, QueryParameters queryParameters) throws HibernateException;
/**
* Execute an <tt>iterate()</tt> query
*/
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException;
Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException;
/**
* Execute a <tt>scroll()</tt> query
*/
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException;
ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException;
/**
* Execute a criteria query
*/
public ScrollableResults scroll(Criteria criteria, ScrollMode scrollMode);
ScrollableResults scroll(Criteria criteria, ScrollMode scrollMode);
/**
* Execute a criteria query
*/
public List list(Criteria criteria);
List list(Criteria criteria);
/**
* Execute a filter
*/
public List listFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException;
List listFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException;
/**
* Iterate a filter
*/
public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
throws HibernateException;
/**
@ -201,45 +201,45 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
* @param entityName optional entity name
* @param object the entity instance
*/
public EntityPersister getEntityPersister(String entityName, Object object) throws HibernateException;
EntityPersister getEntityPersister(String entityName, Object object) throws HibernateException;
/**
* Get the entity instance associated with the given <tt>Key</tt>,
* calling the Interceptor if necessary
*/
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException;
Object getEntityUsingInterceptor(EntityKey key) throws HibernateException;
/**
* Return the identifier of the persistent object, or null if
* not associated with the session
*/
public Serializable getContextEntityIdentifier(Object object);
Serializable getContextEntityIdentifier(Object object);
/**
* The best guess entity name for an entity not in an association
*/
public String bestGuessEntityName(Object object);
String bestGuessEntityName(Object object);
/**
* The guessed entity name for an entity not in an association
*/
public String guessEntityName(Object entity) throws HibernateException;
String guessEntityName(Object entity) throws HibernateException;
/**
* Instantiate the entity class, initializing with the given identifier
*/
public Object instantiate(String entityName, Serializable id) throws HibernateException;
Object instantiate(String entityName, Serializable id) throws HibernateException;
/**
* Execute an SQL Query
*/
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException;
/**
* Execute an SQL Query
*/
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
throws HibernateException;
/**
@ -252,7 +252,7 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*
* @throws HibernateException
*/
public List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
throws HibernateException;
/**
@ -265,16 +265,16 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*
* @throws HibernateException
*/
public ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters);
ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters);
public int getDontFlushFromFind();
int getDontFlushFromFind();
//TODO: temporary
/**
* Get the persistence context for this session
*/
public PersistenceContext getPersistenceContext();
PersistenceContext getPersistenceContext();
/**
* Execute a HQL update or delete query
@ -290,44 +290,44 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
// copied from Session:
public CacheMode getCacheMode();
CacheMode getCacheMode();
public void setCacheMode(CacheMode cm);
void setCacheMode(CacheMode cm);
public boolean isOpen();
boolean isOpen();
public boolean isConnected();
boolean isConnected();
public FlushMode getFlushMode();
FlushMode getFlushMode();
public void setFlushMode(FlushMode fm);
void setFlushMode(FlushMode fm);
public Connection connection();
Connection connection();
public void flush();
void flush();
/**
* Get a Query instance for a named query or named native SQL query
*/
public Query getNamedQuery(String name);
Query getNamedQuery(String name);
/**
* Get a Query instance for a named native SQL query
*/
public Query getNamedSQLQuery(String name);
Query getNamedSQLQuery(String name);
public boolean isEventSource();
boolean isEventSource();
public void afterScrollOperation();
void afterScrollOperation();
/**
* Retrieve access to the session's transaction coordinator.
*
* @return The transaction coordinator.
*/
public TransactionCoordinator getTransactionCoordinator();
TransactionCoordinator getTransactionCoordinator();
public JdbcCoordinator getJdbcCoordinator();
JdbcCoordinator getJdbcCoordinator();
/**
* Determine whether the session is closed. Provided separately from
@ -337,11 +337,11 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*
* @return True if the session is closed; false otherwise.
*/
public boolean isClosed();
boolean isClosed();
public boolean shouldAutoClose();
boolean shouldAutoClose();
public boolean isAutoCloseSessionEnabled();
boolean isAutoCloseSessionEnabled();
/**
* Get the load query influencers associated with this session.
@ -349,7 +349,7 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
* @return the load query influencers associated with this session;
* should never be null.
*/
public LoadQueryInfluencers getLoadQueryInfluencers();
LoadQueryInfluencers getLoadQueryInfluencers();
/**
* Used from EntityManager
@ -369,5 +369,5 @@ public interface SessionImplementor extends Serializable, LobCreationContext {
*/
SQLQuery createSQLQuery(NamedSQLQueryDefinition namedQueryDefinition);
public SessionEventListenerManager getEventListenerManager();
SessionEventListenerManager getEventListenerManager();
}

View File

@ -63,6 +63,7 @@ import org.hibernate.dialect.pagination.NoopLimitHandler;
import org.hibernate.engine.internal.CacheHelper;
import org.hibernate.engine.internal.TwoPhaseLoad;
import org.hibernate.engine.jdbc.ColumnNameCache;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.EntityEntry;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.EntityUniqueKey;
@ -2089,11 +2090,12 @@ public abstract class Loader {
}
private ResultSet wrapResultSetIfEnabled(final ResultSet rs, final SessionImplementor session) {
if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) {
if ( session.getFactory().getSessionFactoryOptions().isWrapResultSetsEnabled() ) {
try {
LOG.debugf( "Wrapping result set [%s]", rs );
return session.getFactory()
.getJdbcServices()
.getServiceRegistry()
.getService( JdbcServices.class )
.getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) );
}
catch(SQLException e) {

View File

@ -42,6 +42,7 @@ import org.hibernate.dialect.pagination.LimitHandler;
import org.hibernate.dialect.pagination.LimitHelper;
import org.hibernate.dialect.pagination.NoopLimitHandler;
import org.hibernate.engine.jdbc.ColumnNameCache;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.RowSelection;
@ -488,13 +489,14 @@ public abstract class AbstractLoadPlanBasedLoader {
private synchronized ResultSet wrapResultSetIfEnabled(final ResultSet rs, final SessionImplementor session) {
// synchronized to avoid multi-thread access issues; defined as method synch to avoid
// potential deadlock issues due to nature of code.
if ( session.getFactory().getSettings().isWrapResultSetsEnabled() ) {
if ( session.getFactory().getSessionFactoryOptions().isWrapResultSetsEnabled() ) {
try {
if ( log.isDebugEnabled() ) {
log.debugf( "Wrapping result set [%s]", rs );
}
return session.getFactory()
.getJdbcServices()
.getServiceRegistry()
.getService( JdbcServices.class )
.getResultSetWrapper().wrap( rs, retreiveColumnNameToIndexCache( rs ) );
}
catch(SQLException e) {

View File

@ -32,6 +32,7 @@ import org.hibernate.LockMode;
import org.hibernate.StaleObjectStateException;
import org.hibernate.WrongClassException;
import org.hibernate.engine.internal.TwoPhaseLoad;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.EntityUniqueKey;
import org.hibernate.engine.spi.SessionImplementor;
@ -336,7 +337,7 @@ public class EntityReferenceInitializerImpl implements EntityReferenceInitialize
context.getProcessingState( entityReference ).registerHydratedState( values );
}
catch (SQLException e) {
throw context.getSession().getFactory().getJdbcServices().getSqlExceptionHelper().convert(
throw context.getSession().getFactory().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().convert(
e,
"Could not read entity state from ResultSet : " + entityKey
);
@ -349,7 +350,7 @@ public class EntityReferenceInitializerImpl implements EntityReferenceInitialize
: null;
}
catch (SQLException e) {
throw context.getSession().getFactory().getJdbcServices().getSqlExceptionHelper().convert(
throw context.getSession().getFactory().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().convert(
e,
"Could not read entity row-id from ResultSet : " + entityKey
);
@ -415,7 +416,7 @@ public class EntityReferenceInitializerImpl implements EntityReferenceInitialize
);
}
catch (SQLException e) {
throw context.getSession().getFactory().getJdbcServices().getSqlExceptionHelper().convert(
throw context.getSession().getFactory().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().convert(
e,
"Could not read discriminator value from ResultSet"
);
@ -486,7 +487,7 @@ public class EntityReferenceInitializerImpl implements EntityReferenceInitialize
);
}
catch (SQLException e) {
throw session.getFactory().getJdbcServices().getSqlExceptionHelper().convert(
throw session.getFactory().getServiceRegistry().getService( JdbcServices.class ).getSqlExceptionHelper().convert(
e,
"Could not read version value from result set"
);

View File

@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.QueryParameters;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.jdbc.Work;
@ -86,7 +87,11 @@ public class SimpleResultSetProcessorTest extends BaseCoreFunctionalTestCase {
new Work() {
@Override
public void execute(Connection connection) throws SQLException {
( (SessionImplementor) workSession ).getFactory().getJdbcServices().getSqlStatementLogger().logStatement( sql );
( (SessionImplementor) workSession ).getFactory()
.getServiceRegistry()
.getService( JdbcServices.class )
.getSqlStatementLogger()
.logStatement( sql );
PreparedStatement ps = connection.prepareStatement( sql );
ps.setInt( 1, 1 );
ResultSet resultSet = ps.executeQuery();