Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.hibernate
Interface SessionFactory  view SessionFactory download SessionFactory.java

All Superinterfaces:
javax.naming.Referenceable, java.io.Serializable

public interface SessionFactory
extends javax.naming.Referenceable, java.io.Serializable

Creates Sessions. Usually an application has a single SessionFactory. Threads servicing client requests obtain Sessions from the factory.

Implementors must be threadsafe.

SessionFactorys are immutable. The behaviour of a SessionFactory is controlled by properties supplied at configuration time. These properties are defined on Environment.


Method Summary
 void close()
          Destroy this SessionFactory and release all resources (caches, connection pools, etc).
 void evict(java.lang.Class persistentClass)
          Evict all entries from the second-level cache.
 void evict(java.lang.Class persistentClass, java.io.Serializable id)
          Evict an entry from the second-level cache.
 void evictCollection(java.lang.String roleName)
          Evict all entries from the second-level cache.
 void evictCollection(java.lang.String roleName, java.io.Serializable id)
          Evict an entry from the second-level cache.
 void evictEntity(java.lang.String entityName)
          Evict all entries from the second-level cache.
 void evictEntity(java.lang.String entityName, java.io.Serializable id)
          Evict an entry from the second-level cache.
 void evictQueries()
          Evict any query result sets cached in the default query cache region.
 void evictQueries(java.lang.String cacheRegion)
          Evict any query result sets cached in the named query cache region.
 java.util.Map getAllClassMetadata()
          Get all ClassMetadata as a Map from entityname String to metadata object
 java.util.Map getAllCollectionMetadata()
          Get all CollectionMetadata as a Map from role name to metadata object
 org.hibernate.metadata.ClassMetadata getClassMetadata(java.lang.Class persistentClass)
          Get the ClassMetadata associated with the given entity class
 org.hibernate.metadata.ClassMetadata getClassMetadata(java.lang.String entityName)
          Get the ClassMetadata associated with the given entity name
 org.hibernate.metadata.CollectionMetadata getCollectionMetadata(java.lang.String roleName)
          Get the CollectionMetadata associated with the named collection role
 org.hibernate.classic.Session getCurrentSession()
          Obtains the current session.
 java.util.Set getDefinedFilterNames()
          Obtain a set of the names of all filters defined on this SessionFactory.
 org.hibernate.engine.FilterDefinition getFilterDefinition(java.lang.String filterName)
          Obtain the definition of a filter by name.
 org.hibernate.stat.Statistics getStatistics()
          Get the statistics for this session factory
 boolean isClosed()
          Was this SessionFactory already closed?
 org.hibernate.classic.Session openSession()
          Create database connection and open a Session on it.
 org.hibernate.classic.Session openSession(java.sql.Connection connection)
          Open a Session on the given connection.
 org.hibernate.classic.Session openSession(java.sql.Connection connection, Interceptor interceptor)
          Open a Session on the given connection, specifying an interceptor.
 org.hibernate.classic.Session openSession(Interceptor interceptor)
          Create database connection and open a Session on it, specifying an interceptor.
 StatelessSession openStatelessSession()
          Get a new stateless session.
 StatelessSession openStatelessSession(java.sql.Connection connection)
          Get a new stateless session for the given JDBC connection.
 
Methods inherited from interface javax.naming.Referenceable
getReference
 

Method Detail

openSession

public org.hibernate.classic.Session openSession(java.sql.Connection connection)
Open a Session on the given connection.

Note that the second-level cache will be disabled if you supply a JDBC connection. Hibernate will not be able to track any statements you might have executed in the same transaction. Consider implementing your own ConnectionProvider.


openSession

public org.hibernate.classic.Session openSession(Interceptor interceptor)
                                          throws HibernateException
Create database connection and open a Session on it, specifying an interceptor.


openSession

public org.hibernate.classic.Session openSession(java.sql.Connection connection,
                                                 Interceptor interceptor)
Open a Session on the given connection, specifying an interceptor.

Note that the second-level cache will be disabled if you supply a JDBC connection. Hibernate will not be able to track any statements you might have executed in the same transaction. Consider implementing your own ConnectionProvider.


openSession

public org.hibernate.classic.Session openSession()
                                          throws HibernateException
Create database connection and open a Session on it.


getCurrentSession

public org.hibernate.classic.Session getCurrentSession()
                                                throws HibernateException
Obtains the current session. The definition of what exactly "current" means controlled by the org.hibernate.context.CurrentSessionContext impl configured for use.

Note that for backwards compatibility, if a org.hibernate.context.CurrentSessionContext is not configured but a JTA org.hibernate.transaction.TransactionManagerLookup is configured this will default to the org.hibernate.context.JTASessionContext impl.


getClassMetadata

public org.hibernate.metadata.ClassMetadata getClassMetadata(java.lang.Class persistentClass)
                                                      throws HibernateException
Get the ClassMetadata associated with the given entity class


getClassMetadata

public org.hibernate.metadata.ClassMetadata getClassMetadata(java.lang.String entityName)
                                                      throws HibernateException
Get the ClassMetadata associated with the given entity name

Since:
3.0

getCollectionMetadata

public org.hibernate.metadata.CollectionMetadata getCollectionMetadata(java.lang.String roleName)
                                                                throws HibernateException
Get the CollectionMetadata associated with the named collection role


getAllClassMetadata

public java.util.Map getAllClassMetadata()
                                  throws HibernateException
Get all ClassMetadata as a Map from entityname String to metadata object

Since:
3.0 changed key from Class to String

getAllCollectionMetadata

public java.util.Map getAllCollectionMetadata()
                                       throws HibernateException
Get all CollectionMetadata as a Map from role name to metadata object


getStatistics

public org.hibernate.stat.Statistics getStatistics()
Get the statistics for this session factory


close

public void close()
           throws HibernateException
Destroy this SessionFactory and release all resources (caches, connection pools, etc). It is the responsibility of the application to ensure that there are no open Sessions before calling close().


isClosed

public boolean isClosed()
Was this SessionFactory already closed?


evict

public void evict(java.lang.Class persistentClass)
           throws HibernateException
Evict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.


evict

public void evict(java.lang.Class persistentClass,
                  java.io.Serializable id)
           throws HibernateException
Evict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.


evictEntity

public void evictEntity(java.lang.String entityName)
                 throws HibernateException
Evict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.


evictEntity

public void evictEntity(java.lang.String entityName,
                        java.io.Serializable id)
                 throws HibernateException
Evict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.


evictCollection

public void evictCollection(java.lang.String roleName)
                     throws HibernateException
Evict all entries from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.


evictCollection

public void evictCollection(java.lang.String roleName,
                            java.io.Serializable id)
                     throws HibernateException
Evict an entry from the second-level cache. This method occurs outside of any transaction; it performs an immediate "hard" remove, so does not respect any transaction isolation semantics of the usage strategy. Use with care.


evictQueries

public void evictQueries()
                  throws HibernateException
Evict any query result sets cached in the default query cache region.


evictQueries

public void evictQueries(java.lang.String cacheRegion)
                  throws HibernateException
Evict any query result sets cached in the named query cache region.


openStatelessSession

public StatelessSession openStatelessSession()
Get a new stateless session.


openStatelessSession

public StatelessSession openStatelessSession(java.sql.Connection connection)
Get a new stateless session for the given JDBC connection.


getDefinedFilterNames

public java.util.Set getDefinedFilterNames()
Obtain a set of the names of all filters defined on this SessionFactory.


getFilterDefinition

public org.hibernate.engine.FilterDefinition getFilterDefinition(java.lang.String filterName)
                                                          throws HibernateException
Obtain the definition of a filter by name.