org.hibernate
Interface SharedSessionContract

All Superinterfaces:
Serializable
All Known Subinterfaces:
EventSource, Session, StatelessSession
All Known Implementing Classes:
AbstractSessionImpl, SessionImpl, StatelessSessionImpl

public interface SharedSessionContract
extends Serializable

Contract methods shared between Session and StatelessSession


Method Summary
 Transaction beginTransaction()
          Begin a unit of work and return the associated Transaction object.
 Criteria createCriteria(Class persistentClass)
          Create Criteria instance for the given class (entity or subclasses/implementors)
 Criteria createCriteria(Class persistentClass, String alias)
          Create Criteria instance for the given class (entity or subclasses/implementors), using a specific alias.
 Criteria createCriteria(String entityName)
          Create Criteria instance for the given entity name.
 Criteria createCriteria(String entityName, String alias)
          Create Criteria instance for the given entity name, using a specific alias.
 Query createQuery(String queryString)
          Create a Query instance for the given HQL query string.
 SQLQuery createSQLQuery(String queryString)
          Create a SQLQuery instance for the given SQL query string.
 Query getNamedQuery(String queryName)
          Create a Query instance for the named query string defined in the metadata.
 String getTenantIdentifier()
          Obtain the tenant identifier associated with this session.
 Transaction getTransaction()
          Get the Transaction instance associated with this session.
 

Method Detail

getTenantIdentifier

String getTenantIdentifier()
Obtain the tenant identifier associated with this session.

Returns:
The tenant identifier associated with this session, or null

beginTransaction

Transaction beginTransaction()
Begin a unit of work and return the associated Transaction object. If a new underlying transaction is required, begin the transaction. Otherwise continue the new work in the context of the existing underlying transaction.

Returns:
a Transaction instance
See Also:
getTransaction()

getTransaction

Transaction getTransaction()
Get the Transaction instance associated with this session. The concrete type of the returned Transaction object is determined by the hibernate.transaction_factory property.

Returns:
a Transaction instance

getNamedQuery

Query getNamedQuery(String queryName)
Create a Query instance for the named query string defined in the metadata.

Parameters:
queryName - the name of a query defined externally
Returns:
The query instance for manipulation and execution

createQuery

Query createQuery(String queryString)
Create a Query instance for the given HQL query string.

Parameters:
queryString - The HQL query
Returns:
The query instance for manipulation and execution

createSQLQuery

SQLQuery createSQLQuery(String queryString)
Create a SQLQuery instance for the given SQL query string.

Parameters:
queryString - The SQL query
Returns:
The query instance for manipulation and execution

createCriteria

Criteria createCriteria(Class persistentClass)
Create Criteria instance for the given class (entity or subclasses/implementors)

Parameters:
persistentClass - The class, which is an entity, or has entity subclasses/implementors
Returns:
The criteria instance for manipulation and execution

createCriteria

Criteria createCriteria(Class persistentClass,
                        String alias)
Create Criteria instance for the given class (entity or subclasses/implementors), using a specific alias.

Parameters:
persistentClass - The class, which is an entity, or has entity subclasses/implementors
alias - The alias to use
Returns:
The criteria instance for manipulation and execution

createCriteria

Criteria createCriteria(String entityName)
Create Criteria instance for the given entity name.

Parameters:
entityName - The entity name
Returns:
The criteria instance for manipulation and execution

createCriteria

Criteria createCriteria(String entityName,
                        String alias)
Create Criteria instance for the given entity name, using a specific alias.

Parameters:
entityName - The entity name
alias - The alias to use
Returns:
The criteria instance for manipulation and execution


Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.