|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.hibernate.jca.JCASessionImpl
A logical session handle, all real work is deligated to underlying physical session represented by ManagedConnectionImpl instance.
Constructor Summary | |
JCASessionImpl(ManagedConnectionImpl mc)
|
Method Summary | |
Transaction |
beginTransaction()
Begin a unit of work and return the associated Transaction object. |
void |
cancelQuery()
Cancel execution of the current query. |
void |
clear()
Completely clear the session. |
Connection |
close()
End the Session by disconnecting from the JDBC connection and cleaning up. |
Connection |
connection()
Get the JDBC connection. |
boolean |
contains(Object object)
Check if this instance is associated with this Session. |
Criteria |
createCriteria(Class persistentClass)
Create a new Criteria instance, for the given entity class. |
Query |
createFilter(Object collection,
String queryString)
Create a new instance of Query for the given collection and filter string. |
Query |
createQuery(String queryString)
Create a new instance of Query for the given query string. |
Query |
createSQLQuery(String string,
String[] returnAliases,
Class[] returnClasses)
Create a new instance of Query for the given SQL string. |
Query |
createSQLQuery(String string,
String returnAlias,
Class returnClass)
Create a new instance of Query for the given SQL string. |
void |
delete(Object object)
Remove a persistent instance from the datastore. |
int |
delete(String query)
Delete all objects returned by the query. |
int |
delete(String query,
Object[] values,
Type[] types)
Delete all objects returned by the query. |
int |
delete(String query,
Object value,
Type type)
Delete all objects returned by the query. |
Connection |
disconnect()
Disconnect the Session from the current JDBC connection. |
void |
evict(Object object)
Remove this instance from the session cache. |
Collection |
filter(Object collection,
String filter)
Apply a filter to a persistent collection. |
Collection |
filter(Object collection,
String filter,
Object[] values,
Type[] types)
Apply a filter to a persistent collection. |
Collection |
filter(Object collection,
String filter,
Object value,
Type type)
Apply a filter to a persistent collection. |
List |
find(String query)
Execute a query. |
List |
find(String query,
Object[] values,
Type[] types)
Execute a query with bind parameters. |
List |
find(String query,
Object value,
Type type)
Execute a query with bind parameters. |
void |
flush()
Force the Session to flush. |
Object |
get(Class clazz,
Serializable id)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. |
Object |
get(Class clazz,
Serializable id,
LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. |
LockMode |
getCurrentLockMode(Object object)
Determine the current lock mode of the given object. |
FlushMode |
getFlushMode()
Get the current flush mode. |
Serializable |
getIdentifier(Object object)
Return the identifier of an entity instance cached by the Session, or throw an exception if the instance is transient or associated with a different Session. |
Query |
getNamedQuery(String queryName)
Obtain an instance of Query for a named query string defined in the mapping file. |
SessionFactory |
getSessionFactory()
Get the SessionFactory that created this instance. |
boolean |
isConnected()
Check if the Session is currently connected. |
boolean |
isDirty()
Does this Session contain any changes which must be synchronized with the database? Would any SQL be executed if we flushed this session? |
boolean |
isOpen()
Check if the Session is still open. |
Iterator |
iterate(String query)
Execute a query and return the results in an iterator. |
Iterator |
iterate(String query,
Object[] values,
Type[] types)
Execute a query and return the results in an iterator. |
Iterator |
iterate(String query,
Object value,
Type type)
Execute a query and return the results in an iterator. |
Object |
load(Class theClass,
Serializable id)
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists. |
Object |
load(Class theClass,
Serializable id,
LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists. |
void |
load(Object object,
Serializable id)
Read the persistent state associated with the given identifier into the given transient instance. |
void |
lock(Object object,
LockMode lockMode)
Obtain the specified lock level upon the given object. |
void |
reconnect()
Obtain a new JDBC connection. |
void |
reconnect(Connection connection)
Reconnect to the given JDBC connection. |
void |
refresh(Object object)
Re-read the state of the given instance from the underlying database. |
void |
refresh(Object object,
LockMode lockMode)
Re-read the state of the given instance from the underlying database, with the given LockMode. |
void |
replicate(Object object,
ReplicationMode mode)
Persist all reachable transient objects, reusing the current identifier values. |
Serializable |
save(Object object)
Persist the given transient instance, first assigning a generated identifier. |
void |
save(Object object,
Serializable id)
Persist the given transient instance, using the given identifier. |
void |
saveOrUpdate(Object object)
Either save() or update() the given instance, depending upon the value of its identifier property. |
Object |
saveOrUpdateCopy(Object object)
Copy the state of the given object onto the persistent object with the same identifier. |
Object |
saveOrUpdateCopy(Object object,
Serializable id)
Copy the state of the given object onto the persistent object with the given identifier. |
void |
setFlushMode(FlushMode flushMode)
Set the flush mode. |
void |
update(Object object)
Update the persistent instance with the identifier of the given transient instance. |
void |
update(Object object,
Serializable id)
Update the persistent state associated with the given identifier. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JCASessionImpl(ManagedConnectionImpl mc)
Method Detail |
public void flush() throws HibernateException
Session
HibernateException
public void setFlushMode(FlushMode flushMode)
Session
setFlushMode
in interface Session
flushMode
- the FlushModeFlushMode
public FlushMode getFlushMode()
Session
getFlushMode
in interface Session
public Connection connection() throws HibernateException
Session
connection
in interface Session
HibernateException
- if the Session is disconnectedpublic Connection disconnect() throws HibernateException
Session
disconnect
in interface Session
HibernateException
- if the Session is disconnectedSession.reconnect()
public void reconnect() throws HibernateException
Session
HibernateException
Session.disconnect()
public void reconnect(Connection connection) throws HibernateException
Session
connection
- a JDBC connection
HibernateException
- if the Session is connectedSession.disconnect()
public Connection close() throws HibernateException
Session
HibernateException
public boolean isOpen()
Session
public boolean isConnected()
Session
isConnected
in interface Session
Session.isConnected()
public Serializable getIdentifier(Object object) throws HibernateException
Session
getIdentifier
in interface Session
object
- a persistent instance
HibernateException
- if the Session is connectedSession.getIdentifier(Object)
public Object load(Class theClass, Serializable id, LockMode lockMode) throws HibernateException
Session
theClass
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockMode
- the lock level
HibernateException
Session.load(Class, Serializable, LockMode)
public Object load(Class theClass, Serializable id) throws HibernateException
Session
theClass
- a persistent classid
- a valid identifier of an existing persistent instance of the class
HibernateException
Session.load(Class, Serializable)
public void load(Object object, Serializable id) throws HibernateException
Session
object
- an "empty" instance of the persistent classid
- a valid identifier of an existing persistent instance of the class
HibernateException
Session.load(Object, Serializable)
public Serializable save(Object object) throws HibernateException
Session
object
- a transient instance of a persistent class
HibernateException
Session.save(Object)
public void save(Object object, Serializable id) throws HibernateException
Session
object
- a transient instance of a persistent classid
- an unused valid identifier
HibernateException
Session.save(Object, Serializable)
public void saveOrUpdate(Object object) throws HibernateException
Session
saveOrUpdate
in interface Session
object
- a transient instance containing new or updated state
HibernateException
Session.saveOrUpdate(Object)
public void update(Object object) throws HibernateException
Session
object
- a transient instance containing updated state
HibernateException
Session.update(Object)
public void update(Object object, Serializable id) throws HibernateException
Session
object
- a transient instance containing updated stateid
- identifier of persistent instance
HibernateException
Session.update(Object, Serializable)
public void delete(Object object) throws HibernateException
Session
object
- the instance to be removed
HibernateException
public List find(String query) throws HibernateException
Session
query
- a query expressed in Hibernate's query language
HibernateException
public List find(String query, Object value, Type type) throws HibernateException
Session
query
- the query stringvalue
- a value to be bound to a "?" placeholder (JDBC IN parameter).type
- the Hibernate type of the value
HibernateException
for access to Type instances
public List find(String query, Object[] values, Type[] types) throws HibernateException
Session
query
- the query stringvalues
- an array of values to be bound to the "?" placeholders (JDBC IN parameters).types
- an array of Hibernate types of the values
HibernateException
for access to Type instances
public Iterator iterate(String query) throws HibernateException
Session
query
- the query string
HibernateException
public Iterator iterate(String query, Object value, Type type) throws HibernateException
Session
query
- the query stringvalue
- a value to be witten to a "?" placeholder in the query stringtype
- the hibernate type of value
HibernateException
public Iterator iterate(String query, Object[] values, Type[] types) throws HibernateException
Session
query
- the query stringvalues
- a list of values to be written to "?" placeholders in the querytypes
- a list of Hibernate types of the values
HibernateException
public Collection filter(Object collection, String filter) throws HibernateException
Session
collection
- a persistent collection to filterfilter
- a filter query string
HibernateException
public Collection filter(Object collection, String filter, Object value, Type type) throws HibernateException
Session
collection
- a persistent collection to filterfilter
- a filter query stringvalue
- a value to be witten to a "?" placeholder in the query stringtype
- the hibernate type of value
HibernateException
public Collection filter(Object collection, String filter, Object[] values, Type[] types) throws HibernateException
Session
collection
- a persistent collection to filterfilter
- a filter query stringvalues
- a list of values to be written to "?" placeholders in the querytypes
- a list of Hibernate types of the values
HibernateException
public int delete(String query) throws HibernateException
Session
query
- the query string
HibernateException
public int delete(String query, Object value, Type type) throws HibernateException
Session
query
- the query stringvalue
- a value to be witten to a "?" placeholder in the query string.type
- the hibernate type of value.
HibernateException
public int delete(String query, Object[] values, Type[] types) throws HibernateException
Session
query
- the query stringvalues
- a list of values to be written to "?" placeholders in the query.types
- a list of Hibernate types of the values
HibernateException
public void lock(Object object, LockMode lockMode) throws HibernateException
Session
object
- a persistent or transient instancelockMode
- the lock level
HibernateException
public void refresh(Object object) throws HibernateException
Session
object
- a persistent or transient instance
HibernateException
public LockMode getCurrentLockMode(Object object) throws HibernateException
Session
getCurrentLockMode
in interface Session
object
- a persistent instance
HibernateException
public Transaction beginTransaction() throws HibernateException
Session
beginTransaction
in interface Session
HibernateException
Transaction
public Query createQuery(String queryString) throws HibernateException
Session
createQuery
in interface Session
queryString
- a Hibernate query
HibernateException
public Query createFilter(Object collection, String queryString) throws HibernateException
Session
createFilter
in interface Session
collection
- a persistent collectionqueryString
- a Hibernate query
HibernateException
public Query getNamedQuery(String queryName) throws HibernateException
Session
getNamedQuery
in interface Session
queryName
- the name of a query defined externally
HibernateException
public Criteria createCriteria(Class persistentClass)
Session
createCriteria
in interface Session
persistentClass
-
public void refresh(Object object, LockMode lockMode) throws HibernateException
Session
object
- a persistent or transient instancelockMode
- the lock mode to use
HibernateException
public boolean contains(Object object)
Session
object
- an instance of a persistent class
public void evict(Object object) throws HibernateException
Session
object
- a persistent instance
HibernateException
public Query createSQLQuery(String string, String returnAlias, Class returnClass)
Session
createSQLQuery
in interface Session
string
- a query expressed in SQLreturnAlias
- a table alias that appears inside {} in the SQL stringreturnClass
- the returned persistent classpublic Query createSQLQuery(String string, String[] returnAliases, Class[] returnClasses)
Session
createSQLQuery
in interface Session
string
- a query expressed in SQLreturnAliases
- an array of table aliases that appear inside {} in the SQL stringreturnClasses
- the returned persistent classespublic void clear()
Session
public Object get(Class clazz, Serializable id, LockMode lockMode) throws HibernateException
Session
clazz
- a persistent classid
- an identifierlockMode
- the lock mode
HibernateException
public Object get(Class clazz, Serializable id) throws HibernateException
Session
clazz
- a persistent classid
- an identifier
HibernateException
public void replicate(Object object, ReplicationMode mode) throws HibernateException
Session
object
- a transient instance of a persistent class
HibernateException
public SessionFactory getSessionFactory()
Session
getSessionFactory
in interface Session
SessionFactory
public void cancelQuery() throws HibernateException
Session
cancelQuery
in interface Session
HibernateException
public Object saveOrUpdateCopy(Object object) throws HibernateException
Session
saveOrUpdateCopy
in interface Session
object
- a transient instance with state to be copied
HibernateException
public Object saveOrUpdateCopy(Object object, Serializable id) throws HibernateException
Session
saveOrUpdateCopy
in interface Session
object
- a persistent or transient instance with state to be copiedid
- the identifier of the instance to copy to
HibernateException
public boolean isDirty() throws HibernateException
Session
HibernateException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |