Methods Summary |
---|
public void | afterOperation(boolean success)
if ( !jdbcContext.isTransactionInProgress() ) {
jdbcContext.afterNontransactionalQuery(success);
}
|
public void | afterScrollOperation()
temporaryPersistenceContext.clear();
|
public void | afterTransactionBegin(org.hibernate.Transaction tx)
|
public void | afterTransactionCompletion(boolean successful, org.hibernate.Transaction tx)
|
protected boolean | autoFlushIfRequired(java.util.Set querySpaces)
// no auto-flushing to support in stateless session
return false;
|
public void | beforeTransactionCompletion(org.hibernate.Transaction tx)
|
public org.hibernate.Transaction | beginTransaction()
errorIfClosed();
Transaction result = getTransaction();
result.begin();
return result;
|
public java.lang.String | bestGuessEntityName(java.lang.Object object)
if (object instanceof HibernateProxy) {
object = ( (HibernateProxy) object ).getHibernateLazyInitializer().getImplementation();
}
return guessEntityName(object);
|
public void | close()
managedClose();
|
public java.sql.Connection | connection()
errorIfClosed();
return jdbcContext.borrowConnection();
|
public org.hibernate.Criteria | createCriteria(java.lang.Class persistentClass, java.lang.String alias)
errorIfClosed();
return new CriteriaImpl( persistentClass.getName(), alias, this );
|
public org.hibernate.Criteria | createCriteria(java.lang.String entityName, java.lang.String alias)
errorIfClosed();
return new CriteriaImpl(entityName, alias, this);
|
public org.hibernate.Criteria | createCriteria(java.lang.Class persistentClass)
errorIfClosed();
return new CriteriaImpl( persistentClass.getName(), this );
|
public org.hibernate.Criteria | createCriteria(java.lang.String entityName)
errorIfClosed();
return new CriteriaImpl(entityName, this);
|
public void | delete(java.lang.Object entity)
errorIfClosed();
delete(null, entity);
|
public void | delete(java.lang.String entityName, java.lang.Object entity)
errorIfClosed();
EntityPersister persister = getEntityPersister(entityName, entity);
Serializable id = persister.getIdentifier(entity, EntityMode.POJO);
Object version = persister.getVersion(entity, EntityMode.POJO);
persister.delete(id, version, entity, this);
|
public int | executeNativeUpdate(org.hibernate.engine.query.sql.NativeSQLQuerySpecification nativeSQLQuerySpecification, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
queryParameters.validateParameters();
NativeSQLQueryPlan plan = getNativeSQLQueryPlan(nativeSQLQuerySpecification);
boolean success = false;
int result = 0;
try {
result = plan.performExecuteUpdate(queryParameters, this);
success = true;
} finally {
afterOperation(success);
}
temporaryPersistenceContext.clear();
return result;
|
public int | executeUpdate(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
queryParameters.validateParameters();
HQLQueryPlan plan = getHQLQueryPlan( query, false );
boolean success = false;
int result = 0;
try {
result = plan.performExecuteUpdate( queryParameters, this );
success = true;
}
finally {
afterOperation(success);
}
temporaryPersistenceContext.clear();
return result;
|
public void | flush()
|
public java.lang.Object | get(java.lang.String entityName, java.io.Serializable id)
return get(entityName, id, LockMode.NONE);
|
public java.lang.Object | get(java.lang.String entityName, java.io.Serializable id, org.hibernate.LockMode lockMode)
errorIfClosed();
Object result = getFactory().getEntityPersister(entityName)
.load(id, null, lockMode, this);
temporaryPersistenceContext.clear();
return result;
|
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.Class entityClass, java.io.Serializable id, org.hibernate.LockMode lockMode)
return get( entityClass.getName(), id, lockMode );
|
public org.hibernate.jdbc.Batcher | getBatcher()
errorIfClosed();
return jdbcContext.getConnectionManager()
.getBatcher();
|
public org.hibernate.CacheMode | getCacheMode()
return CacheMode.IGNORE;
|
public org.hibernate.ConnectionReleaseMode | getConnectionReleaseMode()
return factory.getSettings().getConnectionReleaseMode();
|
public java.io.Serializable | getContextEntityIdentifier(java.lang.Object object)
errorIfClosed();
return null;
|
public int | getDontFlushFromFind()
return 0;
|
public java.util.Map | getEnabledFilters()
return CollectionHelper.EMPTY_MAP;
|
public org.hibernate.EntityMode | getEntityMode()
return EntityMode.POJO;
|
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 {
return factory.getEntityPersister( entityName )
.getSubclassEntityPersister( object, getFactory(), EntityMode.POJO );
}
|
public java.lang.Object | getEntityUsingInterceptor(org.hibernate.engine.EntityKey key)
errorIfClosed();
return null;
|
public java.lang.String | getFetchProfile()
return null;
|
public org.hibernate.type.Type | getFilterParameterType(java.lang.String filterParameterName)
throw new UnsupportedOperationException();
|
public java.lang.Object | getFilterParameterValue(java.lang.String filterParameterName)
throw new UnsupportedOperationException();
|
public org.hibernate.FlushMode | getFlushMode()
return FlushMode.COMMIT;
|
public org.hibernate.Interceptor | getInterceptor()
return EmptyInterceptor.INSTANCE;
|
public org.hibernate.jdbc.JDBCContext | getJDBCContext()
return jdbcContext;
|
public org.hibernate.event.EventListeners | getListeners()
throw new UnsupportedOperationException();
|
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()
return temporaryPersistenceContext;
|
public long | getTimestamp()
throw new UnsupportedOperationException();
|
public org.hibernate.Transaction | getTransaction()
errorIfClosed();
return jdbcContext.getTransaction();
|
public java.lang.String | guessEntityName(java.lang.Object entity)
errorIfClosed();
return entity.getClass().getName();
|
public java.lang.Object | immediateLoad(java.lang.String entityName, java.io.Serializable id)
throw new SessionException("proxies cannot be fetched by a stateless session");
|
public void | initializeCollection(org.hibernate.collection.PersistentCollection collection, boolean writing)
throw new SessionException("collections cannot be fetched by a stateless session");
|
public java.io.Serializable | insert(java.lang.Object entity)
errorIfClosed();
return insert(null, entity);
|
public java.io.Serializable | insert(java.lang.String entityName, java.lang.Object entity)
errorIfClosed();
EntityPersister persister = getEntityPersister(entityName, entity);
Serializable id = persister.getIdentifierGenerator().generate(this, entity);
Object[] state = persister.getPropertyValues(entity, EntityMode.POJO);
if ( persister.isVersioned() ) {
boolean substitute = Versioning.seedVersion(state, persister.getVersionProperty(), persister.getVersionType(), this);
if ( substitute ) {
persister.setPropertyValues( entity, state, EntityMode.POJO );
}
}
if ( id == IdentifierGeneratorFactory.POST_INSERT_INDICATOR ) {
id = persister.insert(state, entity, this);
}
else {
persister.insert(id, state, entity, this);
}
persister.setIdentifier(entity, id, EntityMode.POJO);
return id;
|
public java.lang.Object | instantiate(java.lang.String entityName, java.io.Serializable id)
errorIfClosed();
return getFactory().getEntityPersister( entityName )
.instantiate( id, EntityMode.POJO );
|
public java.lang.Object | internalLoad(java.lang.String entityName, java.io.Serializable id, boolean eager, boolean nullable)
errorIfClosed();
EntityPersister persister = getFactory().getEntityPersister(entityName);
if ( !eager && persister.hasProxy() ) {
return persister.createProxy(id, this);
}
Object loaded = temporaryPersistenceContext.getEntity( new EntityKey(id, persister, EntityMode.POJO) );
//TODO: if not loaded, throw an exception
return loaded==null ? get( entityName, id ) : loaded;
|
public boolean | isAutoCloseSessionEnabled()
return factory.getSettings().isAutoCloseSessionEnabled();
|
public boolean | isConnected()
return jdbcContext.getConnectionManager().isCurrentlyConnected();
|
public boolean | isEventSource()
return false;
|
public boolean | isFlushBeforeCompletionEnabled()
return true;
|
public boolean | isFlushModeNever()
return false;
|
public boolean | isOpen()
return !isClosed();
|
public boolean | isTransactionInProgress()
return jdbcContext.isTransactionInProgress();
|
public java.util.Iterator | iterate(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
throw new UnsupportedOperationException();
|
public java.util.Iterator | iterateFilter(java.lang.Object collection, java.lang.String filter, org.hibernate.engine.QueryParameters queryParameters)
throw new UnsupportedOperationException();
|
public java.util.List | list(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
queryParameters.validateParameters();
HQLQueryPlan plan = getHQLQueryPlan( query, false );
boolean success = false;
List results = CollectionHelper.EMPTY_LIST;
try {
results = plan.performList( queryParameters, this );
success = true;
}
finally {
afterOperation(success);
}
temporaryPersistenceContext.clear();
return results;
|
public java.util.List | list(CriteriaImpl criteria)
errorIfClosed();
String[] implementors = factory.getImplementors( criteria.getEntityOrClassName() );
int size = implementors.length;
CriteriaLoader[] loaders = new CriteriaLoader[size];
for( int i=0; i <size; i++ ) {
loaders[i] = new CriteriaLoader(
getOuterJoinLoadable( implementors[i] ),
factory,
criteria,
implementors[i],
getEnabledFilters()
);
}
List results = Collections.EMPTY_LIST;
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 {
afterOperation(success);
}
temporaryPersistenceContext.clear();
return results;
|
public java.util.List | listCustomQuery(org.hibernate.loader.custom.CustomQuery customQuery, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
CustomLoader loader = new CustomLoader( customQuery, getFactory() );
boolean success = false;
List results;
try {
results = loader.list(this, queryParameters);
success = true;
}
finally {
afterOperation(success);
}
temporaryPersistenceContext.clear();
return results;
|
public java.util.List | listFilter(java.lang.Object collection, java.lang.String filter, org.hibernate.engine.QueryParameters queryParameters)
throw new UnsupportedOperationException();
|
public void | managedClose()
if ( isClosed() ) {
throw new SessionException( "Session was already closed!" );
}
jdbcContext.getConnectionManager().close();
setClosed();
|
public void | managedFlush()
errorIfClosed();
getBatcher().executeBatch();
|
public void | refresh(java.lang.Object entity)
refresh( bestGuessEntityName( entity ), entity, LockMode.NONE );
|
public void | refresh(java.lang.String entityName, java.lang.Object entity)
refresh( entityName, entity, LockMode.NONE );
|
public void | refresh(java.lang.Object entity, org.hibernate.LockMode lockMode)
refresh( bestGuessEntityName( entity ), entity, lockMode );
|
public void | refresh(java.lang.String entityName, java.lang.Object entity, org.hibernate.LockMode lockMode)
final EntityPersister persister = this.getEntityPersister( entityName, entity );
final Serializable id = persister.getIdentifier( entity, getEntityMode() );
if ( log.isTraceEnabled() ) {
log.trace(
"refreshing transient " +
MessageHelper.infoString( persister, id, this.getFactory() )
);
}
// TODO : can this ever happen???
// EntityKey key = new EntityKey( id, persister, source.getEntityMode() );
// if ( source.getPersistenceContext().getEntry( key ) != null ) {
// throw new PersistentObjectException(
// "attempted to refresh transient instance when persistent " +
// "instance was already associated with the Session: " +
// MessageHelper.infoString( persister, id, source.getFactory() )
// );
// }
if ( persister.hasCache() ) {
final CacheKey ck = new CacheKey(
id,
persister.getIdentifierType(),
persister.getRootEntityName(),
this.getEntityMode(),
this.getFactory()
);
persister.getCache().remove(ck);
}
String previousFetchProfile = this.getFetchProfile();
Object result = null;
try {
this.setFetchProfile( "refresh" );
result = persister.load( id, entity, lockMode, this );
}
finally {
this.setFetchProfile( previousFetchProfile );
}
UnresolvableObjectException.throwIfNull( result, id, persister.getEntityName() );
|
public org.hibernate.ScrollableResults | scroll(CriteriaImpl criteria, org.hibernate.ScrollMode scrollMode)
errorIfClosed();
String entityName = criteria.getEntityOrClassName();
CriteriaLoader loader = new CriteriaLoader(
getOuterJoinLoadable(entityName),
factory,
criteria,
entityName,
getEnabledFilters()
);
return loader.scroll(this, scrollMode);
|
public org.hibernate.ScrollableResults | scroll(java.lang.String query, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
HQLQueryPlan plan = getHQLQueryPlan( query, false );
return plan.performScroll( queryParameters, this );
|
public org.hibernate.ScrollableResults | scrollCustomQuery(org.hibernate.loader.custom.CustomQuery customQuery, org.hibernate.engine.QueryParameters queryParameters)
errorIfClosed();
CustomLoader loader = new CustomLoader( customQuery, getFactory() );
return loader.scroll(queryParameters, this);
|
public void | setAutoClear(boolean enabled)
throw new UnsupportedOperationException();
|
public void | setCacheMode(org.hibernate.CacheMode cm)
throw new UnsupportedOperationException();
|
public void | setFetchProfile(java.lang.String name)
|
public void | setFlushMode(org.hibernate.FlushMode fm)
throw new UnsupportedOperationException();
|
public boolean | shouldAutoClose()
return isAutoCloseSessionEnabled() && !isClosed();
|
public void | update(java.lang.Object entity)
errorIfClosed();
update(null, entity);
|
public void | update(java.lang.String entityName, java.lang.Object entity)
errorIfClosed();
EntityPersister persister = getEntityPersister(entityName, entity);
Serializable id = persister.getIdentifier(entity, EntityMode.POJO);
Object[] state = persister.getPropertyValues(entity, EntityMode.POJO);
Object oldVersion;
if ( persister.isVersioned() ) {
oldVersion = persister.getVersion(entity, EntityMode.POJO);
Object newVersion = Versioning.increment( oldVersion, persister.getVersionType(), this );
Versioning.setVersion(state, newVersion, persister);
persister.setPropertyValues(entity, state, EntityMode.POJO);
}
else {
oldVersion = null;
}
persister.update(id, state, null, false, null, oldVersion, entity, null, this);
|