Methods Summary |
---|
public void | afterOperation(boolean success)Check if there is a Hibernate or JTA transaction in progress and,
if there is not, flush if necessary, make sure the connection has
been committed (if it is not in autocommit mode) and run the after
completion processing
if ( !jdbcContext.isTransactionInProgress() ) {
jdbcContext.afterNontransactionalQuery( success );
}
|
public void | afterScrollOperation()
// nothing to do in a stateful session
|
public void | afterTransactionBegin(org.hibernate.Transaction tx)
errorIfClosed();
interceptor.afterTransactionBegin(tx);
|
public void | afterTransactionCompletion(boolean success, org.hibernate.Transaction tx)
log.trace( "after transaction completion" );
persistenceContext.afterTransactionCompletion();
actionQueue.afterTransactionCompletion(success);
if ( rootSession == null && tx != null ) {
try {
interceptor.afterTransactionCompletion(tx);
}
catch (Throwable t) {
log.error("exception in interceptor afterTransactionCompletion()", t);
}
}
if ( autoClear ) {
clear();
}
|
protected boolean | autoFlushIfRequired(java.util.Set querySpaces)detect in-memory changes, determine if the changes are to tables
named in the query and, if so, complete execution the flush
errorIfClosed();
if ( ! isTransactionInProgress() ) {
// do not auto-flush while outside a transaction
return false;
}
AutoFlushEvent event = new AutoFlushEvent(querySpaces, this);
AutoFlushEventListener[] autoFlushEventListener = listeners.getAutoFlushEventListeners();
for ( int i = 0; i < autoFlushEventListener.length; i++ ) {
autoFlushEventListener[i].onAutoFlush(event);
}
return event.isFlushRequired();
|
public void | beforeTransactionCompletion(org.hibernate.Transaction tx)
log.trace( "before transaction completion" );
if ( rootSession == null ) {
try {
interceptor.beforeTransactionCompletion(tx);
}
catch (Throwable t) {
log.error("exception in interceptor beforeTransactionCompletion()", t);
}
}
|
public org.hibernate.Transaction | beginTransaction()
errorIfClosed();
if ( rootSession != null ) {
// todo : should seriously consider not allowing a txn to begin from a child session
// can always route the request to the root session...
log.warn( "Transaction started on non-root session" );
}
Transaction result = getTransaction();
result.begin();
return result;
|
public java.lang.String | bestGuessEntityName(java.lang.Object object)
if (object instanceof HibernateProxy) {
LazyInitializer initializer = ( ( HibernateProxy ) object ).getHibernateLazyInitializer();
// it is possible for this method to be called during flush processing,
// so make certain that we do not accidently initialize an uninitialized proxy
if ( initializer.isUninitialized() ) {
return initializer.getEntityName();
}
object = initializer.getImplementation();
}
EntityEntry entry = persistenceContext.getEntry(object);
if (entry==null) {
return guessEntityName(object);
}
else {
return entry.getPersister().getEntityName();
}
|
public void | cancelQuery()
errorIfClosed();
getBatcher().cancelLastQuery();
|
private void | checkTransactionSynchStatus()
if ( jdbcContext != null && !isClosed() ) {
jdbcContext.registerSynchronizationIfPossible();
}
|
private void | cleanup()clear all the internal collections, just
to help the garbage collector, does not
clear anything that is needed during the
afterTransactionCompletion() phase
persistenceContext.clear();
|
public void | clear()
errorIfClosed();
checkTransactionSynchStatus();
persistenceContext.clear();
actionQueue.clear();
|
public java.sql.Connection | close()
log.trace( "closing session" );
if ( isClosed() ) {
throw new SessionException( "Session was already closed" );
}
if ( factory.getStatistics().isStatisticsEnabled() ) {
factory.getStatisticsImplementor().closeSession();
}
try {
try {
if ( childSessionsByEntityMode != null ) {
Iterator childSessions = childSessionsByEntityMode.values().iterator();
while ( childSessions.hasNext() ) {
final SessionImpl child = ( SessionImpl ) childSessions.next();
child.close();
}
}
}
catch( Throwable t ) {
// just ignore
}
if ( rootSession == null ) {
return jdbcContext.getConnectionManager().close();
}
else {
return null;
}
}
finally {
setClosed();
cleanup();
}
|
public java.sql.Connection | connection()
errorIfClosed();
return jdbcContext.borrowConnection();
|
public boolean | contains(java.lang.Object object)
errorIfClosed();
checkTransactionSynchStatus();
if ( object instanceof HibernateProxy ) {
//do not use proxiesByKey, since not all
//proxies that point to this session's
//instances are in that collection!
LazyInitializer li = ( (HibernateProxy) object ).getHibernateLazyInitializer();
if ( li.isUninitialized() ) {
//if it is an uninitialized proxy, pointing
//with this session, then when it is accessed,
//the underlying instance will be "contained"
return li.getSession()==this;
}
else {
//if it is initialized, see if the underlying
//instance is contained, since we need to
//account for the fact that it might have been
//evicted
object = li.getImplementation();
}
}
// A session is considered to contain an entity only if the entity has
// an entry in the session's persistence context and the entry reports
// that the entity has not been removed
EntityEntry entry = persistenceContext.getEntry( object );
return entry != null && entry.getStatus() != Status.DELETED && entry.getStatus() != Status.GONE;
|
public org.hibernate.Criteria | createCriteria(java.lang.Class persistentClass, java.lang.String alias)
errorIfClosed();
checkTransactionSynchStatus();
return new CriteriaImpl( persistentClass.getName(), alias, this );
|
public org.hibernate.Criteria | createCriteria(java.lang.String entityName, java.lang.String alias)
errorIfClosed();
checkTransactionSynchStatus();
return new CriteriaImpl(entityName, alias, this);
|
public org.hibernate.Criteria | createCriteria(java.lang.Class persistentClass)
errorIfClosed();
checkTransactionSynchStatus();
return new CriteriaImpl( persistentClass.getName(), this );
|
public org.hibernate.Criteria | createCriteria(java.lang.String entityName)
errorIfClosed();
checkTransactionSynchStatus();
return new CriteriaImpl(entityName, this);
|
public org.hibernate.Query | createFilter(java.lang.Object collection, java.lang.String queryString)
errorIfClosed();
checkTransactionSynchStatus();
CollectionFilterImpl filter = new CollectionFilterImpl(
queryString,
collection,
this,
getFilterQueryPlan( collection, queryString, null, false ).getParameterMetadata()
);
filter.setComment( queryString );
return filter;
|
public org.hibernate.Query | createQuery(java.lang.String queryString)
errorIfClosed();
checkTransactionSynchStatus();
return super.createQuery(queryString);
|
public org.hibernate.SQLQuery | createSQLQuery(java.lang.String sql)
errorIfClosed();
checkTransactionSynchStatus();
return super.createSQLQuery(sql);
|
public org.hibernate.Query | createSQLQuery(java.lang.String sql, java.lang.String returnAlias, java.lang.Class returnClass)
errorIfClosed();
checkTransactionSynchStatus();
return new SQLQueryImpl(
sql,
new String[] { returnAlias },
new Class[] { returnClass },
this,
factory.getQueryPlanCache().getSQLParameterMetadata( sql )
);
|
public org.hibernate.Query | createSQLQuery(java.lang.String sql, java.lang.String[] returnAliases, java.lang.Class[] returnClasses)
errorIfClosed();
checkTransactionSynchStatus();
return new SQLQueryImpl(
sql,
returnAliases,
returnClasses,
this,
factory.getQueryPlanCache().getSQLParameterMetadata( sql )
);
|
public int | delete(java.lang.String query)
return delete( query, ArrayHelper.EMPTY_OBJECT_ARRAY, ArrayHelper.EMPTY_TYPE_ARRAY );
|
public int | delete(java.lang.String query, java.lang.Object value, org.hibernate.type.Type type)
return delete( query, new Object[]{value}, new Type[]{type} );
|
public int | delete(java.lang.String query, java.lang.Object[] values, org.hibernate.type.Type[] types)
errorIfClosed();
checkTransactionSynchStatus();
if ( query == null ) {
throw new IllegalArgumentException("attempt to perform delete-by-query with null query");
}
if ( log.isTraceEnabled() ) {
log.trace( "delete: " + query );
if ( values.length != 0 ) {
log.trace( "parameters: " + StringHelper.toString( values ) );
}
}
List list = find( query, values, types );
int deletionCount = list.size();
for ( int i = 0; i < deletionCount; i++ ) {
delete( list.get( i ) );
}
return deletionCount;
|
public void | delete(java.lang.Object object)Delete a persistent object
fireDelete( new DeleteEvent(object, this) );
|
public void | delete(java.lang.String entityName, java.lang.Object object)Delete a persistent object (by explicit entity name)
fireDelete( new DeleteEvent( entityName, object, this ) );
|
public void | delete(java.lang.String entityName, java.lang.Object object, boolean isCascadeDeleteEnabled, java.util.Set transientEntities)Delete a persistent object
fireDelete( new DeleteEvent( entityName, object, isCascadeDeleteEnabled, this ), transientEntities );
|
public void | disableFilter(java.lang.String filterName)
errorIfClosed();
checkTransactionSynchStatus();
enabledFilters.remove(filterName);
|
public java.sql.Connection | disconnect()
errorIfClosed();
log.debug( "disconnecting session" );
return jdbcContext.getConnectionManager().manualDisconnect();
|
public org.hibernate.Filter | enableFilter(java.lang.String filterName)
errorIfClosed();
checkTransactionSynchStatus();
FilterImpl filter = new FilterImpl( factory.getFilterDefinition(filterName) );
enabledFilters.put(filterName, filter);
return filter;
|
public void | evict(java.lang.Object object)remove any hard references to the entity that are held by the infrastructure
(references held by application or other persistant instances are okay)
fireEvict( new EvictEvent(object, this) );
|
public int | executeNativeUpdate(org.hibernate.engine.query.sql.NativeSQLQuerySpecification nativeQuerySpecification, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
queryParameters.validateParameters();
NativeSQLQueryPlan plan = getNativeSQLQueryPlan(nativeQuerySpecification);
autoFlushIfRequired( plan.getCustomQuery().getQuerySpaces() );
boolean success = false;
int result = 0;
try {
result = plan.performExecuteUpdate(queryParameters, this);
success = true;
} finally {
afterOperation(success);
}
return result;
|
public int | executeUpdate(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
queryParameters.validateParameters();
HQLQueryPlan plan = getHQLQueryPlan( query, false );
autoFlushIfRequired( plan.getQuerySpaces() );
boolean success = false;
int result = 0;
try {
result = plan.performExecuteUpdate( queryParameters, this );
success = true;
}
finally {
afterOperation(success);
}
return result;
|
public java.util.Collection | filter(java.lang.Object collection, java.lang.String filter)
return listFilter( collection, filter, new QueryParameters( new Type[1], new Object[1] ) );
|
public java.util.Collection | filter(java.lang.Object collection, java.lang.String filter, java.lang.Object value, org.hibernate.type.Type type)
return listFilter( collection, filter, new QueryParameters( new Type[]{null, type}, new Object[]{null, value} ) );
|
public java.util.Collection | filter(java.lang.Object collection, java.lang.String filter, java.lang.Object[] values, org.hibernate.type.Type[] types)
Object[] vals = new Object[values.length + 1];
Type[] typs = new Type[types.length + 1];
System.arraycopy( values, 0, vals, 1, values.length );
System.arraycopy( types, 0, typs, 1, types.length );
return listFilter( collection, filter, new QueryParameters( typs, vals ) );
|
public java.util.List | find(java.lang.String query)Retrieve a list of persistent objects using a hibernate query
return list( query, new QueryParameters() );
|
public java.util.List | find(java.lang.String query, java.lang.Object value, org.hibernate.type.Type type)
return list( query, new QueryParameters(type, value) );
|
public java.util.List | find(java.lang.String query, java.lang.Object[] values, org.hibernate.type.Type[] types)
return list( query, new QueryParameters(types, values) );
|
private void | fireDelete(org.hibernate.event.DeleteEvent event)
errorIfClosed();
checkTransactionSynchStatus();
DeleteEventListener[] deleteEventListener = listeners.getDeleteEventListeners();
for ( int i = 0; i < deleteEventListener.length; i++ ) {
deleteEventListener[i].onDelete( event );
}
|
private void | fireDelete(org.hibernate.event.DeleteEvent event, java.util.Set transientEntities)
errorIfClosed();
checkTransactionSynchStatus();
DeleteEventListener[] deleteEventListener = listeners.getDeleteEventListeners();
for ( int i = 0; i < deleteEventListener.length; i++ ) {
deleteEventListener[i].onDelete( event, transientEntities );
}
|
private void | fireEvict(org.hibernate.event.EvictEvent evictEvent)
errorIfClosed();
checkTransactionSynchStatus();
EvictEventListener[] evictEventListener = listeners.getEvictEventListeners();
for ( int i = 0; i < evictEventListener.length; i++ ) {
evictEventListener[i].onEvict( evictEvent );
}
|
private void | fireLoad(org.hibernate.event.LoadEvent event, org.hibernate.event.LoadEventListener.LoadType loadType)
errorIfClosed();
checkTransactionSynchStatus();
LoadEventListener[] loadEventListener = listeners.getLoadEventListeners();
for ( int i = 0; i < loadEventListener.length; i++ ) {
loadEventListener[i].onLoad(event, loadType);
}
|
private void | fireLock(org.hibernate.event.LockEvent lockEvent)
errorIfClosed();
checkTransactionSynchStatus();
LockEventListener[] lockEventListener = listeners.getLockEventListeners();
for ( int i = 0; i < lockEventListener.length; i++ ) {
lockEventListener[i].onLock( lockEvent );
}
|
private java.lang.Object | fireMerge(org.hibernate.event.MergeEvent event)
errorIfClosed();
checkTransactionSynchStatus();
MergeEventListener[] mergeEventListener = listeners.getMergeEventListeners();
for ( int i = 0; i < mergeEventListener.length; i++ ) {
mergeEventListener[i].onMerge(event);
}
return event.getResult();
|
private void | fireMerge(java.util.Map copiedAlready, org.hibernate.event.MergeEvent event)
errorIfClosed();
checkTransactionSynchStatus();
MergeEventListener[] mergeEventListener = listeners.getMergeEventListeners();
for ( int i = 0; i < mergeEventListener.length; i++ ) {
mergeEventListener[i].onMerge(event, copiedAlready);
}
|
private void | firePersist(java.util.Map copiedAlready, org.hibernate.event.PersistEvent event)
errorIfClosed();
checkTransactionSynchStatus();
PersistEventListener[] persistEventListener = listeners.getPersistEventListeners();
for ( int i = 0; i < persistEventListener.length; i++ ) {
persistEventListener[i].onPersist(event, copiedAlready);
}
|
private void | firePersist(org.hibernate.event.PersistEvent event)
errorIfClosed();
checkTransactionSynchStatus();
PersistEventListener[] createEventListener = listeners.getPersistEventListeners();
for ( int i = 0; i < createEventListener.length; i++ ) {
createEventListener[i].onPersist(event);
}
|
private void | firePersistOnFlush(java.util.Map copiedAlready, org.hibernate.event.PersistEvent event)
errorIfClosed();
checkTransactionSynchStatus();
PersistEventListener[] persistEventListener = listeners.getPersistOnFlushEventListeners();
for ( int i = 0; i < persistEventListener.length; i++ ) {
persistEventListener[i].onPersist(event, copiedAlready);
}
|
private void | firePersistOnFlush(org.hibernate.event.PersistEvent event)
errorIfClosed();
checkTransactionSynchStatus();
PersistEventListener[] createEventListener = listeners.getPersistOnFlushEventListeners();
for ( int i = 0; i < createEventListener.length; i++ ) {
createEventListener[i].onPersist(event);
}
|
private void | fireRefresh(org.hibernate.event.RefreshEvent refreshEvent)
errorIfClosed();
checkTransactionSynchStatus();
RefreshEventListener[] refreshEventListener = listeners.getRefreshEventListeners();
for ( int i = 0; i < refreshEventListener.length; i++ ) {
refreshEventListener[i].onRefresh( refreshEvent );
}
|
private void | fireRefresh(java.util.Map refreshedAlready, org.hibernate.event.RefreshEvent refreshEvent)
errorIfClosed();
checkTransactionSynchStatus();
RefreshEventListener[] refreshEventListener = listeners.getRefreshEventListeners();
for ( int i = 0; i < refreshEventListener.length; i++ ) {
refreshEventListener[i].onRefresh( refreshEvent, refreshedAlready );
}
|
private void | fireReplicate(org.hibernate.event.ReplicateEvent event)
errorIfClosed();
checkTransactionSynchStatus();
ReplicateEventListener[] replicateEventListener = listeners.getReplicateEventListeners();
for ( int i = 0; i < replicateEventListener.length; i++ ) {
replicateEventListener[i].onReplicate(event);
}
|
private java.io.Serializable | fireSave(org.hibernate.event.SaveOrUpdateEvent event)
errorIfClosed();
checkTransactionSynchStatus();
SaveOrUpdateEventListener[] saveEventListener = listeners.getSaveEventListeners();
for ( int i = 0; i < saveEventListener.length; i++ ) {
saveEventListener[i].onSaveOrUpdate(event);
}
return event.getResultId();
|
private void | fireSaveOrUpdate(org.hibernate.event.SaveOrUpdateEvent event)
errorIfClosed();
checkTransactionSynchStatus();
SaveOrUpdateEventListener[] saveOrUpdateEventListener = listeners.getSaveOrUpdateEventListeners();
for ( int i = 0; i < saveOrUpdateEventListener.length; i++ ) {
saveOrUpdateEventListener[i].onSaveOrUpdate(event);
}
|
private void | fireSaveOrUpdateCopy(java.util.Map copiedAlready, org.hibernate.event.MergeEvent event)
errorIfClosed();
checkTransactionSynchStatus();
MergeEventListener[] saveOrUpdateCopyEventListener = listeners.getSaveOrUpdateCopyEventListeners();
for ( int i = 0; i < saveOrUpdateCopyEventListener.length; i++ ) {
saveOrUpdateCopyEventListener[i].onMerge(event, copiedAlready);
}
|
private java.lang.Object | fireSaveOrUpdateCopy(org.hibernate.event.MergeEvent event)
errorIfClosed();
checkTransactionSynchStatus();
MergeEventListener[] saveOrUpdateCopyEventListener = listeners.getSaveOrUpdateCopyEventListeners();
for ( int i = 0; i < saveOrUpdateCopyEventListener.length; i++ ) {
saveOrUpdateCopyEventListener[i].onMerge(event);
}
return event.getResult();
|
private void | fireUpdate(org.hibernate.event.SaveOrUpdateEvent event)
errorIfClosed();
checkTransactionSynchStatus();
SaveOrUpdateEventListener[] updateEventListener = listeners.getUpdateEventListeners();
for ( int i = 0; i < updateEventListener.length; i++ ) {
updateEventListener[i].onSaveOrUpdate(event);
}
|
public void | flush()
errorIfClosed();
checkTransactionSynchStatus();
if ( persistenceContext.getCascadeLevel() > 0 ) {
throw new HibernateException("Flush during cascade is dangerous");
}
FlushEventListener[] flushEventListener = listeners.getFlushEventListeners();
for ( int i = 0; i < flushEventListener.length; i++ ) {
flushEventListener[i].onFlush( new FlushEvent(this) );
}
|
public void | forceFlush(org.hibernate.engine.EntityEntry entityEntry)
errorIfClosed();
if ( log.isDebugEnabled() ) {
log.debug(
"flushing to force deletion of re-saved object: " +
MessageHelper.infoString( entityEntry.getPersister(), entityEntry.getId(), getFactory() )
);
}
if ( persistenceContext.getCascadeLevel() > 0 ) {
throw new ObjectDeletedException(
"deleted object would be re-saved by cascade (remove deleted object from associations)",
entityEntry.getId(),
entityEntry.getPersister().getEntityName()
);
}
flush();
|
public java.lang.Object | get(java.lang.Class entityClass, java.io.Serializable id)
return get( entityClass.getName(), id );
|
public java.lang.Object | get(java.lang.String entityName, java.io.Serializable id)
LoadEvent event = new LoadEvent(id, entityName, false, this);
boolean success = false;
try {
fireLoad(event, LoadEventListener.GET);
success = true;
return event.getResult();
}
finally {
afterOperation(success);
}
|
public java.lang.Object | get(java.lang.Class entityClass, java.io.Serializable id, org.hibernate.LockMode lockMode)
return get( entityClass.getName(), id, lockMode );
|
public java.lang.Object | get(java.lang.String entityName, java.io.Serializable id, org.hibernate.LockMode lockMode)
LoadEvent event = new LoadEvent(id, entityName, lockMode, this);
fireLoad(event, LoadEventListener.GET);
return event.getResult();
|
public org.hibernate.engine.ActionQueue | getActionQueue()
errorIfClosed();
checkTransactionSynchStatus();
return actionQueue;
|
public org.hibernate.jdbc.Batcher | getBatcher()
errorIfClosed();
checkTransactionSynchStatus();
// TODO : should remove this exposure
// and have all references to the session's batcher use the ConnectionManager.
return jdbcContext.getConnectionManager().getBatcher();
|
public org.hibernate.CacheMode | getCacheMode()
checkTransactionSynchStatus();
return cacheMode;
|
public org.hibernate.ConnectionReleaseMode | getConnectionReleaseMode()
checkTransactionSynchStatus();
return connectionReleaseMode;
|
public java.io.Serializable | getContextEntityIdentifier(java.lang.Object object)Get the id value for an object that is actually associated with the session. This
is a bit stricter than getEntityIdentifierIfNotUnsaved().
errorIfClosed();
if ( object instanceof HibernateProxy ) {
return getProxyIdentifier(object);
}
else {
EntityEntry entry = persistenceContext.getEntry(object);
return entry != null ? entry.getId() : null;
}
|
public org.hibernate.LockMode | getCurrentLockMode(java.lang.Object object)
errorIfClosed();
checkTransactionSynchStatus();
if ( object == null ) {
throw new NullPointerException( "null object passed to getCurrentLockMode()" );
}
if ( object instanceof HibernateProxy ) {
object = ( (HibernateProxy) object ).getHibernateLazyInitializer().getImplementation(this);
if ( object == null ) {
return LockMode.NONE;
}
}
EntityEntry e = persistenceContext.getEntry(object);
if ( e == null ) {
throw new TransientObjectException( "Given object not associated with the session" );
}
if ( e.getStatus() != Status.MANAGED ) {
throw new ObjectDeletedException(
"The given object was deleted",
e.getId(),
e.getPersister().getEntityName()
);
}
return e.getLockMode();
|
public int | getDontFlushFromFind()
return dontFlushFromFind;
|
public org.hibernate.Filter | getEnabledFilter(java.lang.String filterName)
checkTransactionSynchStatus();
return (Filter) enabledFilters.get(filterName);
|
public java.util.Map | getEnabledFilters()
errorIfClosed();
checkTransactionSynchStatus();
// First, validate all the enabled filters...
//TODO: this implementation has bad performance
Iterator itr = enabledFilters.values().iterator();
while ( itr.hasNext() ) {
final Filter filter = (Filter) itr.next();
filter.validate();
}
return enabledFilters;
|
public org.hibernate.EntityMode | getEntityMode()
checkTransactionSynchStatus();
return entityMode;
|
public java.lang.String | getEntityName(java.lang.Object object)
errorIfClosed();
checkTransactionSynchStatus();
if (object instanceof HibernateProxy) {
if ( !persistenceContext.containsProxy( object ) ) {
throw new TransientObjectException("proxy was not associated with the session");
}
object = ( (HibernateProxy) object ).getHibernateLazyInitializer().getImplementation();
}
EntityEntry entry = persistenceContext.getEntry(object);
if ( entry == null ) {
throwTransientObjectException( object );
}
return entry.getPersister().getEntityName();
|
public org.hibernate.persister.entity.EntityPersister | getEntityPersister(java.lang.String entityName, java.lang.Object object)
errorIfClosed();
if (entityName==null) {
return factory.getEntityPersister( guessEntityName( object ) );
}
else {
// try block is a hack around fact that currently tuplizers are not
// given the opportunity to resolve a subclass entity name. this
// allows the (we assume custom) interceptor the ability to
// influence this decision if we were not able to based on the
// given entityName
try {
return factory.getEntityPersister( entityName )
.getSubclassEntityPersister( object, getFactory(), entityMode );
}
catch( HibernateException e ) {
try {
return getEntityPersister( null, object );
}
catch( HibernateException e2 ) {
throw e;
}
}
}
|
public java.lang.Object | getEntityUsingInterceptor(org.hibernate.engine.EntityKey key)
errorIfClosed();
// todo : should this get moved to PersistentContext?
// logically, is PersistentContext the "thing" to which an interceptor gets attached?
final Object result = persistenceContext.getEntity(key);
if ( result == null ) {
final Object newObject = interceptor.getEntity( key.getEntityName(), key.getIdentifier() );
if ( newObject != null ) {
lock( newObject, LockMode.NONE );
}
return newObject;
}
else {
return result;
}
|
public java.lang.String | getFetchProfile()
checkTransactionSynchStatus();
return fetchProfile;
|
public org.hibernate.type.Type | getFilterParameterType(java.lang.String filterParameterName)
errorIfClosed();
checkTransactionSynchStatus();
String[] parsed = parseFilterParameterName(filterParameterName);
FilterDefinition filterDef = factory.getFilterDefinition( parsed[0] );
if (filterDef == null) {
throw new IllegalArgumentException("Filter [" + parsed[0] + "] not defined");
}
Type type = filterDef.getParameterType( parsed[1] );
if (type == null) {
// this is an internal error of some sort...
throw new InternalError("Unable to locate type for filter parameter");
}
return type;
|
public java.lang.Object | getFilterParameterValue(java.lang.String filterParameterName)
errorIfClosed();
checkTransactionSynchStatus();
String[] parsed = parseFilterParameterName(filterParameterName);
FilterImpl filter = (FilterImpl) enabledFilters.get( parsed[0] );
if (filter == null) {
throw new IllegalArgumentException("Filter [" + parsed[0] + "] currently not enabled");
}
return filter.getParameter( parsed[1] );
|
private org.hibernate.engine.query.FilterQueryPlan | getFilterQueryPlan(java.lang.Object collection, java.lang.String filter, org.hibernate.engine.QueryParameters parameters, boolean shallow)
if ( collection == null ) {
throw new NullPointerException( "null collection passed to filter" );
}
CollectionEntry entry = persistenceContext.getCollectionEntryOrNull( collection );
final CollectionPersister roleBeforeFlush = (entry == null) ? null : entry.getLoadedPersister();
FilterQueryPlan plan = null;
if ( roleBeforeFlush == null ) {
// if it was previously unreferenced, we need to flush in order to
// get its state into the database in order to execute query
flush();
entry = persistenceContext.getCollectionEntryOrNull( collection );
CollectionPersister roleAfterFlush = (entry == null) ? null : entry.getLoadedPersister();
if ( roleAfterFlush == null ) {
throw new QueryException( "The collection was unreferenced" );
}
plan = factory.getQueryPlanCache().getFilterQueryPlan( filter, roleAfterFlush.getRole(), shallow, getEnabledFilters() );
}
else {
// otherwise, we only need to flush if there are in-memory changes
// to the queried tables
plan = factory.getQueryPlanCache().getFilterQueryPlan( filter, roleBeforeFlush.getRole(), shallow, getEnabledFilters() );
if ( autoFlushIfRequired( plan.getQuerySpaces() ) ) {
// might need to run a different filter entirely after the flush
// because the collection role may have changed
entry = persistenceContext.getCollectionEntryOrNull( collection );
CollectionPersister roleAfterFlush = (entry == null) ? null : entry.getLoadedPersister();
if ( roleBeforeFlush != roleAfterFlush ) {
if ( roleAfterFlush == null ) {
throw new QueryException( "The collection was dereferenced" );
}
plan = factory.getQueryPlanCache().getFilterQueryPlan( filter, roleAfterFlush.getRole(), shallow, getEnabledFilters() );
}
}
}
if ( parameters != null ) {
parameters.getPositionalParameterValues()[0] = entry.getLoadedKey();
parameters.getPositionalParameterTypes()[0] = entry.getLoadedPersister().getKeyType();
}
return plan;
|
public org.hibernate.FlushMode | getFlushMode()
checkTransactionSynchStatus();
return flushMode;
|
public java.io.Serializable | getIdentifier(java.lang.Object object)
errorIfClosed();
checkTransactionSynchStatus();
if ( object instanceof HibernateProxy ) {
LazyInitializer li = ( (HibernateProxy) object ).getHibernateLazyInitializer();
if ( li.getSession() != this ) {
throw new TransientObjectException( "The proxy was not associated with this session" );
}
return li.getIdentifier();
}
else {
EntityEntry entry = persistenceContext.getEntry(object);
if ( entry == null ) {
throw new TransientObjectException( "The instance was not associated with this session" );
}
return entry.getId();
}
|
public org.hibernate.Interceptor | getInterceptor()
checkTransactionSynchStatus();
return interceptor;
|
public org.hibernate.jdbc.JDBCContext | getJDBCContext()
errorIfClosed();
checkTransactionSynchStatus();
return jdbcContext;
|
public org.hibernate.event.EventListeners | getListeners()
return listeners;
|
public org.hibernate.Query | getNamedQuery(java.lang.String queryName)
errorIfClosed();
checkTransactionSynchStatus();
return super.getNamedQuery(queryName);
|
private org.hibernate.persister.entity.OuterJoinLoadable | getOuterJoinLoadable(java.lang.String entityName)
EntityPersister persister = factory.getEntityPersister(entityName);
if ( !(persister instanceof OuterJoinLoadable) ) {
throw new MappingException( "class persister is not OuterJoinLoadable: " + entityName );
}
return ( OuterJoinLoadable ) persister;
|
public org.hibernate.engine.PersistenceContext | getPersistenceContext()
errorIfClosed();
checkTransactionSynchStatus();
return persistenceContext;
|
private java.io.Serializable | getProxyIdentifier(java.lang.Object proxy)
return ( (HibernateProxy) proxy ).getHibernateLazyInitializer().getIdentifier();
|
public org.hibernate.Session | getSession(org.hibernate.EntityMode entityMode)
if ( this.entityMode == entityMode ) {
return this;
}
if ( rootSession != null ) {
rootSession.getSession( entityMode );
}
errorIfClosed();
checkTransactionSynchStatus();
SessionImpl rtn = null;
if ( childSessionsByEntityMode == null ) {
childSessionsByEntityMode = new HashMap();
}
else {
rtn = (SessionImpl) childSessionsByEntityMode.get( entityMode );
}
if ( rtn == null ) {
rtn = new SessionImpl( this, entityMode );
childSessionsByEntityMode.put( entityMode, rtn );
}
return rtn;
|
public org.hibernate.SessionFactory | getSessionFactory()
checkTransactionSynchStatus();
return factory;
|
public org.hibernate.stat.SessionStatistics | getStatistics()
checkTransactionSynchStatus();
return new SessionStatisticsImpl(this);
|
public long | getTimestamp()
checkTransactionSynchStatus();
return timestamp;
|
public org.hibernate.Transaction | getTransaction()
errorIfClosed();
return jdbcContext.getTransaction();
|
public java.lang.String | guessEntityName(java.lang.Object object)
errorIfClosed();
String entity = interceptor.getEntityName( object );
if ( entity == null ) {
if ( object instanceof Map ) {
entity = (String) ( (Map) object ).get( DynamicMapInstantiator.KEY );
if ( entity == null ) {
throw new HibernateException( "could not determine type of dynamic entity" );
}
}
else if ( object instanceof Element ) {
// TODO : really need to keep a map of nodeName -> entityName, but that would mean nodeName being distinct
entity = ( (Element) object ).getName();
}
else {
entity = object.getClass().getName();
}
}
return entity;
|
public java.lang.Object | immediateLoad(java.lang.String entityName, java.io.Serializable id)Load the data for the object with the specified id into a newly created object.
This is only called when lazily initializing a proxy.
Do NOT return a proxy.
if ( log.isDebugEnabled() ) {
EntityPersister persister = getFactory().getEntityPersister(entityName);
log.debug( "initializing proxy: " + MessageHelper.infoString( persister, id, getFactory() ) );
}
LoadEvent event = new LoadEvent(id, entityName, true, this);
fireLoad(event, LoadEventListener.IMMEDIATE_LOAD);
return event.getResult();
|
public void | initializeCollection(org.hibernate.collection.PersistentCollection collection, boolean writing)
errorIfClosed();
checkTransactionSynchStatus();
InitializeCollectionEventListener[] listener = listeners.getInitializeCollectionEventListeners();
for ( int i = 0; i < listener.length; i++ ) {
listener[i].onInitializeCollection( new InitializeCollectionEvent(collection, this) );
}
|
public java.lang.Object | instantiate(java.lang.String entityName, java.io.Serializable id)
return instantiate( factory.getEntityPersister(entityName), id );
|
public java.lang.Object | instantiate(org.hibernate.persister.entity.EntityPersister persister, java.io.Serializable id)give the interceptor an opportunity to override the default instantiation
errorIfClosed();
checkTransactionSynchStatus();
Object result = interceptor.instantiate( persister.getEntityName(), entityMode, id );
if ( result == null ) {
result = persister.instantiate( id, entityMode );
}
return result;
|
public java.lang.Object | internalLoad(java.lang.String entityName, java.io.Serializable id, boolean eager, boolean nullable)
// todo : remove
LoadEventListener.LoadType type = nullable ?
LoadEventListener.INTERNAL_LOAD_NULLABLE :
eager ? LoadEventListener.INTERNAL_LOAD_EAGER : LoadEventListener.INTERNAL_LOAD_LAZY;
LoadEvent event = new LoadEvent(id, entityName, true, this);
fireLoad(event, type);
if ( !nullable ) {
UnresolvableObjectException.throwIfNull( event.getResult(), id, entityName );
}
return event.getResult();
|
public boolean | isAutoCloseSessionEnabled()
return autoCloseSessionEnabled;
|
public boolean | isConnected()
checkTransactionSynchStatus();
return !isClosed() && jdbcContext.getConnectionManager().isCurrentlyConnected();
|
public boolean | isDirty()
errorIfClosed();
checkTransactionSynchStatus();
log.debug("checking session dirtiness");
if ( actionQueue.areInsertionsOrDeletionsQueued() ) {
log.debug("session dirty (scheduled updates and insertions)");
return true;
}
else {
DirtyCheckEvent event = new DirtyCheckEvent(this);
DirtyCheckEventListener[] dirtyCheckEventListener = listeners.getDirtyCheckEventListeners();
for ( int i = 0; i < dirtyCheckEventListener.length; i++ ) {
dirtyCheckEventListener[i].onDirtyCheck(event);
}
return event.isDirty();
}
|
public boolean | isEventSource()
checkTransactionSynchStatus();
return true;
|
public boolean | isFlushBeforeCompletionEnabled()
return flushBeforeCompletionEnabled;
|
public boolean | isFlushModeNever()
return FlushMode.isManualFlushMode( getFlushMode() );
|
public boolean | isOpen()
checkTransactionSynchStatus();
return !isClosed();
|
public boolean | isTransactionInProgress()
checkTransactionSynchStatus();
return !isClosed() && jdbcContext.isTransactionInProgress();
|
public java.util.Iterator | iterate(java.lang.String query)
return iterate( query, new QueryParameters() );
|
public java.util.Iterator | iterate(java.lang.String query, java.lang.Object value, org.hibernate.type.Type type)
return iterate( query, new QueryParameters(type, value) );
|
public java.util.Iterator | iterate(java.lang.String query, java.lang.Object[] values, org.hibernate.type.Type[] types)
return iterate( query, new QueryParameters(types, values) );
|
public java.util.Iterator | iterate(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
queryParameters.validateParameters();
HQLQueryPlan plan = getHQLQueryPlan( query, true );
autoFlushIfRequired( plan.getQuerySpaces() );
dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
try {
return plan.performIterate( queryParameters, this );
}
finally {
dontFlushFromFind--;
}
|
public java.util.Iterator | iterateFilter(java.lang.Object collection, java.lang.String filter, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
FilterQueryPlan plan = getFilterQueryPlan( collection, filter, queryParameters, true );
return plan.performIterate( queryParameters, this );
|
public java.util.List | list(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
queryParameters.validateParameters();
HQLQueryPlan plan = getHQLQueryPlan( query, false );
autoFlushIfRequired( plan.getQuerySpaces() );
List results = CollectionHelper.EMPTY_LIST;
boolean success = false;
dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
try {
results = plan.performList( queryParameters, this );
success = true;
}
finally {
dontFlushFromFind--;
afterOperation(success);
}
return results;
|
public java.util.List | list(CriteriaImpl criteria)
errorIfClosed();
checkTransactionSynchStatus();
String[] implementors = factory.getImplementors( criteria.getEntityOrClassName() );
int size = implementors.length;
CriteriaLoader[] loaders = new CriteriaLoader[size];
Set spaces = new HashSet();
for( int i=0; i <size; i++ ) {
loaders[i] = new CriteriaLoader(
getOuterJoinLoadable( implementors[i] ),
factory,
criteria,
implementors[i],
getEnabledFilters()
);
spaces.addAll( loaders[i].getQuerySpaces() );
}
autoFlushIfRequired(spaces);
List results = Collections.EMPTY_LIST;
dontFlushFromFind++;
boolean success = false;
try {
for( int i=0; i<size; i++ ) {
final List currentResults = loaders[i].list(this);
currentResults.addAll(results);
results = currentResults;
}
success = true;
}
finally {
dontFlushFromFind--;
afterOperation(success);
}
return results;
|
public java.util.List | listCustomQuery(org.hibernate.loader.custom.CustomQuery customQuery, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
if ( log.isTraceEnabled() ) {
log.trace( "SQL query: " + customQuery.getSQL() );
}
CustomLoader loader = new CustomLoader( customQuery, getFactory() );
autoFlushIfRequired( loader.getQuerySpaces() );
dontFlushFromFind++;
boolean success = false;
try {
List results = loader.list(this, queryParameters);
success = true;
return results;
}
finally {
dontFlushFromFind--;
afterOperation(success);
}
|
public java.util.List | listFilter(java.lang.Object collection, java.lang.String filter, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
FilterQueryPlan plan = getFilterQueryPlan( collection, filter, queryParameters, false );
List results = CollectionHelper.EMPTY_LIST;
boolean success = false;
dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
try {
results = plan.performList( queryParameters, this );
success = true;
}
finally {
dontFlushFromFind--;
afterOperation(success);
}
return results;
|
public void | load(java.lang.Object object, java.io.Serializable id)
LoadEvent event = new LoadEvent(id, object, this);
fireLoad( event, LoadEventListener.RELOAD );
|
public java.lang.Object | load(java.lang.Class entityClass, java.io.Serializable id)
return load( entityClass.getName(), id );
|
public java.lang.Object | load(java.lang.String entityName, java.io.Serializable id)
LoadEvent event = new LoadEvent(id, entityName, false, this);
boolean success = false;
try {
fireLoad( event, LoadEventListener.LOAD );
if ( event.getResult() == null ) {
getFactory().getEntityNotFoundDelegate().handleEntityNotFound( entityName, id );
}
success = true;
return event.getResult();
}
finally {
afterOperation(success);
}
|
public java.lang.Object | load(java.lang.Class entityClass, java.io.Serializable id, org.hibernate.LockMode lockMode)
return load( entityClass.getName(), id, lockMode );
|
public java.lang.Object | load(java.lang.String entityName, java.io.Serializable id, org.hibernate.LockMode lockMode)
LoadEvent event = new LoadEvent(id, entityName, lockMode, this);
fireLoad( event, LoadEventListener.LOAD );
return event.getResult();
|
public void | lock(java.lang.String entityName, java.lang.Object object, org.hibernate.LockMode lockMode)
fireLock( new LockEvent(entityName, object, lockMode, this) );
|
public void | lock(java.lang.Object object, org.hibernate.LockMode lockMode)
fireLock( new LockEvent(object, lockMode, this) );
|
public void | managedClose()
log.trace( "automatically closing session" );
close();
|
public void | managedFlush()
if ( isClosed() ) {
log.trace( "skipping auto-flush due to session closed" );
return;
}
log.trace("automatically flushing session");
flush();
if ( childSessionsByEntityMode != null ) {
Iterator iter = childSessionsByEntityMode.values().iterator();
while ( iter.hasNext() ) {
( (Session) iter.next() ).flush();
}
}
|
public java.lang.Object | merge(java.lang.String entityName, java.lang.Object object)
return fireMerge( new MergeEvent(entityName, object, this) );
|
public java.lang.Object | merge(java.lang.Object object)
return merge(null, object);
|
public void | merge(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
fireMerge( copiedAlready, new MergeEvent(entityName, object, this) );
|
private java.lang.String[] | parseFilterParameterName(java.lang.String filterParameterName)
int dot = filterParameterName.indexOf('.");
if (dot <= 0) {
throw new IllegalArgumentException("Invalid filter-parameter name format"); // TODO: what type?
}
String filterName = filterParameterName.substring(0, dot);
String parameterName = filterParameterName.substring(dot+1);
return new String[] {filterName, parameterName};
|
public void | persist(java.lang.String entityName, java.lang.Object object)
firePersist( new PersistEvent(entityName, object, this) );
|
public void | persist(java.lang.Object object)
persist(null, object);
|
public void | persist(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
firePersist( copiedAlready, new PersistEvent(entityName, object, this) );
|
public void | persistOnFlush(java.lang.String entityName, java.lang.Object object)
firePersistOnFlush( new PersistEvent(entityName, object, this) );
|
public void | persistOnFlush(java.lang.Object object)
persist(null, object);
|
public void | persistOnFlush(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
firePersistOnFlush( copiedAlready, new PersistEvent(entityName, object, this) );
|
private void | readObject(java.io.ObjectInputStream ois)Used by JDK serialization...
log.trace( "deserializing session" );
boolean isRootSession = ois.readBoolean();
connectionReleaseMode = ConnectionReleaseMode.parse( ( String ) ois.readObject() );
entityMode = EntityMode.parse( ( String ) ois.readObject() );
autoClear = ois.readBoolean();
flushMode = FlushMode.parse( ( String ) ois.readObject() );
cacheMode = CacheMode.parse( ( String ) ois.readObject() );
flushBeforeCompletionEnabled = ois.readBoolean();
autoCloseSessionEnabled = ois.readBoolean();
fetchProfile = ( String ) ois.readObject();
interceptor = ( Interceptor ) ois.readObject();
factory = SessionFactoryImpl.deserialize( ois );
listeners = factory.getEventListeners();
if ( isRootSession ) {
jdbcContext = JDBCContext.deserialize( ois, this, interceptor );
}
persistenceContext = StatefulPersistenceContext.deserialize( ois, this );
actionQueue = ActionQueue.deserialize( ois, this );
enabledFilters = ( Map ) ois.readObject();
childSessionsByEntityMode = ( Map ) ois.readObject();
Iterator iter = enabledFilters.values().iterator();
while ( iter.hasNext() ) {
( ( FilterImpl ) iter.next() ).afterDeserialize(factory);
}
if ( isRootSession && childSessionsByEntityMode != null ) {
iter = childSessionsByEntityMode.values().iterator();
while ( iter.hasNext() ) {
final SessionImpl child = ( ( SessionImpl ) iter.next() );
child.rootSession = this;
child.jdbcContext = this.jdbcContext;
}
}
|
public void | reconnect()
errorIfClosed();
log.debug( "reconnecting session" );
checkTransactionSynchStatus();
jdbcContext.getConnectionManager().manualReconnect();
|
public void | reconnect(java.sql.Connection conn)
errorIfClosed();
log.debug( "reconnecting session" );
checkTransactionSynchStatus();
jdbcContext.getConnectionManager().manualReconnect( conn );
|
public void | refresh(java.lang.Object object)
fireRefresh( new RefreshEvent(object, this) );
|
public void | refresh(java.lang.Object object, org.hibernate.LockMode lockMode)
fireRefresh( new RefreshEvent(object, lockMode, this) );
|
public void | refresh(java.lang.Object object, java.util.Map refreshedAlready)
fireRefresh( refreshedAlready, new RefreshEvent(object, this) );
|
public void | replicate(java.lang.Object obj, org.hibernate.ReplicationMode replicationMode)
fireReplicate( new ReplicateEvent(obj, replicationMode, this) );
|
public void | replicate(java.lang.String entityName, java.lang.Object obj, org.hibernate.ReplicationMode replicationMode)
fireReplicate( new ReplicateEvent(entityName, obj, replicationMode, this) );
|
public void | save(java.lang.Object obj, java.io.Serializable id)
save(null, obj, id);
|
public java.io.Serializable | save(java.lang.Object obj)
return save(null, obj);
|
public java.io.Serializable | save(java.lang.String entityName, java.lang.Object object)
return fireSave( new SaveOrUpdateEvent(entityName, object, this) );
|
public void | save(java.lang.String entityName, java.lang.Object object, java.io.Serializable id)
fireSave( new SaveOrUpdateEvent(entityName, object, id, this) );
|
public void | saveOrUpdate(java.lang.Object object)
saveOrUpdate(null, object);
|
public void | saveOrUpdate(java.lang.String entityName, java.lang.Object obj)
fireSaveOrUpdate( new SaveOrUpdateEvent(entityName, obj, this) );
|
public java.lang.Object | saveOrUpdateCopy(java.lang.String entityName, java.lang.Object object)
return fireSaveOrUpdateCopy( new MergeEvent(entityName, object, this) );
|
public java.lang.Object | saveOrUpdateCopy(java.lang.Object object)
return saveOrUpdateCopy( null, object );
|
public java.lang.Object | saveOrUpdateCopy(java.lang.String entityName, java.lang.Object object, java.io.Serializable id)
return fireSaveOrUpdateCopy( new MergeEvent(entityName, object, id, this) );
|
public java.lang.Object | saveOrUpdateCopy(java.lang.Object object, java.io.Serializable id)
return saveOrUpdateCopy( null, object, id );
|
public void | saveOrUpdateCopy(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
fireSaveOrUpdateCopy( copiedAlready, new MergeEvent( entityName, object, this ) );
|
public org.hibernate.ScrollableResults | scroll(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
HQLQueryPlan plan = getHQLQueryPlan( query, false );
autoFlushIfRequired( plan.getQuerySpaces() );
dontFlushFromFind++;
try {
return plan.performScroll( queryParameters, this );
}
finally {
dontFlushFromFind--;
}
|
public org.hibernate.ScrollableResults | scroll(CriteriaImpl criteria, org.hibernate.ScrollMode scrollMode)
errorIfClosed();
checkTransactionSynchStatus();
String entityName = criteria.getEntityOrClassName();
CriteriaLoader loader = new CriteriaLoader(
getOuterJoinLoadable(entityName),
factory,
criteria,
entityName,
getEnabledFilters()
);
autoFlushIfRequired( loader.getQuerySpaces() );
dontFlushFromFind++;
try {
return loader.scroll(this, scrollMode);
}
finally {
dontFlushFromFind--;
}
|
public org.hibernate.ScrollableResults | scrollCustomQuery(org.hibernate.loader.custom.CustomQuery customQuery, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
checkTransactionSynchStatus();
if ( log.isTraceEnabled() ) {
log.trace( "scroll SQL query: " + customQuery.getSQL() );
}
CustomLoader loader = new CustomLoader( customQuery, getFactory() );
autoFlushIfRequired( loader.getQuerySpaces() );
dontFlushFromFind++; //stops flush being called multiple times if this method is recursively called
try {
return loader.scroll(queryParameters, this);
}
finally {
dontFlushFromFind--;
}
|
public void | setAutoClear(boolean enabled)
errorIfClosed();
autoClear = enabled;
|
public void | setCacheMode(org.hibernate.CacheMode cacheMode)
errorIfClosed();
checkTransactionSynchStatus();
if ( log.isTraceEnabled() ) {
log.trace("setting cache mode to: " + cacheMode);
}
this.cacheMode= cacheMode;
|
public void | setFetchProfile(java.lang.String fetchProfile)
errorIfClosed();
checkTransactionSynchStatus();
this.fetchProfile = fetchProfile;
|
public void | setFlushMode(org.hibernate.FlushMode flushMode)
errorIfClosed();
checkTransactionSynchStatus();
if ( log.isTraceEnabled() ) {
log.trace("setting flush mode to: " + flushMode);
}
this.flushMode = flushMode;
|
public void | setReadOnly(java.lang.Object entity, boolean readOnly)
errorIfClosed();
checkTransactionSynchStatus();
persistenceContext.setReadOnly(entity, readOnly);
|
public boolean | shouldAutoClose()
return isAutoCloseSessionEnabled() && !isClosed();
|
private void | throwTransientObjectException(java.lang.Object object)
throw new TransientObjectException(
"object references an unsaved transient instance - save the transient instance before flushing: " +
guessEntityName(object)
);
|
public java.lang.String | toString()
StringBuffer buf = new StringBuffer(500)
.append( "SessionImpl(" );
if ( !isClosed() ) {
buf.append(persistenceContext)
.append(";")
.append(actionQueue);
}
else {
buf.append("<closed>");
}
return buf.append(')").toString();
|
public void | update(java.lang.Object obj)
update(null, obj);
|
public void | update(java.lang.Object obj, java.io.Serializable id)
update(null, obj, id);
|
public void | update(java.lang.String entityName, java.lang.Object object)
fireUpdate( new SaveOrUpdateEvent(entityName, object, this) );
|
public void | update(java.lang.String entityName, java.lang.Object object, java.io.Serializable id)
fireUpdate(new SaveOrUpdateEvent(entityName, object, id, this));
|
private void | writeObject(java.io.ObjectOutputStream oos)Used by JDK serialization...
if ( !jdbcContext.getConnectionManager().isReadyForSerialization() ) {
throw new IllegalStateException( "Cannot serialize a session while connected" );
}
log.trace( "serializing session" );
oos.writeBoolean( rootSession == null );
oos.writeObject( connectionReleaseMode.toString() );
oos.writeObject( entityMode.toString() );
oos.writeBoolean( autoClear );
oos.writeObject( flushMode.toString() );
oos.writeObject( cacheMode.toString() );
oos.writeBoolean( flushBeforeCompletionEnabled );
oos.writeBoolean( autoCloseSessionEnabled );
oos.writeObject( fetchProfile );
// we need to writeObject() on this since interceptor is user defined
oos.writeObject( interceptor );
factory.serialize( oos );
if ( rootSession == null ) {
jdbcContext.serialize( oos );
}
persistenceContext.serialize( oos );
actionQueue.serialize( oos );
// todo : look at optimizing these...
oos.writeObject( enabledFilters );
oos.writeObject( childSessionsByEntityMode );
|