站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Hibernate 2.1.8 正式版 API 英文文档

JCASessionImpl (Hibernate API Documentation) - Hibernate 2.1.8 正式版 API 英文文档


net.sf.hibernate.jca
Class JCASessionImpl

java.lang.Object
  extended bynet.sf.hibernate.jca.JCASessionImpl
All Implemented Interfaces:
Serializable, Session

public class JCASessionImpl
extends Object
implements Session

A logical session handle, all real work is deligated to underlying physical session represented by ManagedConnectionImpl instance.

See Also:
Serialized Form

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

JCASessionImpl

public JCASessionImpl(ManagedConnectionImpl mc)
Method Detail

flush

public void flush()
           throws HibernateException
Description copied from interface: Session
Force the Session to flush. Must be called at the end of a unit of work, before commiting the transaction and closing the session (Transaction.commit() calls this method). Flushing is the process of synchronising the underlying persistent store with persistable state held in memory.

Specified by:
flush in interface Session
Throws:
HibernateException

setFlushMode

public void setFlushMode(FlushMode flushMode)
Description copied from interface: Session
Set the flush mode. The flush mode determines at which points Hibernate automatically flushes the session. For a readonly session, it is reasonable to set the flush mode to FlushMode.NEVER at the start of the session (in order to achieve some extra performance).

Specified by:
setFlushMode in interface Session
Parameters:
flushMode - the FlushMode
See Also:
FlushMode

getFlushMode

public FlushMode getFlushMode()
Description copied from interface: Session
Get the current flush mode.

Specified by:
getFlushMode in interface Session
Returns:
FlushMode

connection

public Connection connection()
                      throws HibernateException
Description copied from interface: Session
Get the JDBC connection. Applications are responsible for calling commit/rollback upon the connection before closing the Session.

Specified by:
connection in interface Session
Returns:
the JDBC connection in use by the Session
Throws:
HibernateException - if the Session is disconnected

disconnect

public Connection disconnect()
                      throws HibernateException
Description copied from interface: Session
Disconnect the Session from the current JDBC connection. If the connection was obtained by Hibernate, close it or return it to the connection pool. Otherwise return it to the application.

This is used by applications which require long transactions.

Specified by:
disconnect in interface Session
Returns:
the connection provided by the application or null
Throws:
HibernateException - if the Session is disconnected
See Also:
Session.reconnect()

reconnect

public void reconnect()
               throws HibernateException
Description copied from interface: Session
Obtain a new JDBC connection. This is used by applications which require long transactions.

Specified by:
reconnect in interface Session
Throws:
HibernateException
See Also:
Session.disconnect()

reconnect

public void reconnect(Connection connection)
               throws HibernateException
Description copied from interface: Session
Reconnect to the given JDBC connection. This is used by applications which require long transactions.

Specified by:
reconnect in interface Session
Parameters:
connection - a JDBC connection
Throws:
HibernateException - if the Session is connected
See Also:
Session.disconnect()

close

public Connection close()
                 throws HibernateException
Description copied from interface: Session
End the Session by disconnecting from the JDBC connection and cleaning up. It is not strictly necessary to close() the Session but you must at least disconnect() it.

Specified by:
close in interface Session
Returns:
the connection provided by the application or null
Throws:
HibernateException

isOpen

public boolean isOpen()
Description copied from interface: Session
Check if the Session is still open.

Specified by:
isOpen in interface Session
Returns:
boolean

isConnected

public boolean isConnected()
Description copied from interface: Session
Check if the Session is currently connected.

Specified by:
isConnected in interface Session
Returns:
boolean
See Also:
Session.isConnected()

getIdentifier

public Serializable getIdentifier(Object object)
                           throws HibernateException
Description copied from interface: Session
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.

Specified by:
getIdentifier in interface Session
Parameters:
object - a persistent instance
Returns:
the identifier
Throws:
HibernateException - if the Session is connected
See Also:
Session.getIdentifier(Object)

load

public Object load(Class theClass,
                   Serializable id,
                   LockMode lockMode)
            throws HibernateException
Description copied from interface: Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.

Specified by:
load in interface Session
Parameters:
theClass - a persistent class
id - a valid identifier of an existing persistent instance of the class
lockMode - the lock level
Returns:
the persistent instance or proxy
Throws:
HibernateException
See Also:
Session.load(Class, Serializable, LockMode)

load

public Object load(Class theClass,
                   Serializable id)
            throws HibernateException
Description copied from interface: Session
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.

You should not use this method to determine if an instance exists (use find() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.

Specified by:
load in interface Session
Parameters:
theClass - a persistent class
id - a valid identifier of an existing persistent instance of the class
Returns:
the persistent instance or proxy
Throws:
HibernateException
See Also:
Session.load(Class, Serializable)

load

public void load(Object object,
                 Serializable id)
          throws HibernateException
Description copied from interface: Session
Read the persistent state associated with the given identifier into the given transient instance.

Specified by:
load in interface Session
Parameters:
object - an "empty" instance of the persistent class
id - a valid identifier of an existing persistent instance of the class
Throws:
HibernateException
See Also:
Session.load(Object, Serializable)

save

public Serializable save(Object object)
                  throws HibernateException
Description copied from interface: Session
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.)

Specified by:
save in interface Session
Parameters:
object - a transient instance of a persistent class
Returns:
the generated identifier
Throws:
HibernateException
See Also:
Session.save(Object)

save

public void save(Object object,
                 Serializable id)
          throws HibernateException
Description copied from interface: Session
Persist the given transient instance, using the given identifier.

Specified by:
save in interface Session
Parameters:
object - a transient instance of a persistent class
id - an unused valid identifier
Throws:
HibernateException
See Also:
Session.save(Object, Serializable)

saveOrUpdate

public void saveOrUpdate(Object object)
                  throws HibernateException
Description copied from interface: Session
Either save() or update() the given instance, depending upon the value of its identifier property. By default the instance is always saved. This behaviour may be adjusted by specifying an unsaved-value attribute of the identifier property mapping.

Specified by:
saveOrUpdate in interface Session
Parameters:
object - a transient instance containing new or updated state
Throws:
HibernateException
See Also:
Session.saveOrUpdate(Object)

update

public void update(Object object)
            throws HibernateException
Description copied from interface: Session
Update the persistent instance with the identifier of the given transient instance. If there is a persistent instance with the same identifier, an exception is thrown.

If the given transient instance has a null identifier, an exception will be thrown.

Specified by:
update in interface Session
Parameters:
object - a transient instance containing updated state
Throws:
HibernateException
See Also:
Session.update(Object)

update

public void update(Object object,
                   Serializable id)
            throws HibernateException
Description copied from interface: Session
Update the persistent state associated with the given identifier. An exception is thrown if there is a persistent instance with the same identifier in the current session.

Specified by:
update in interface Session
Parameters:
object - a transient instance containing updated state
id - identifier of persistent instance
Throws:
HibernateException
See Also:
Session.update(Object, Serializable)

delete

public void delete(Object object)
            throws HibernateException
Description copied from interface: Session
Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state.

Specified by:
delete in interface Session
Parameters:
object - the instance to be removed
Throws:
HibernateException

find

public List find(String query)
          throws HibernateException
Description copied from interface: Session
Execute a query.

Specified by:
find in interface Session
Parameters:
query - a query expressed in Hibernate's query language
Returns:
a distinct list of instances (or arrays of instances)
Throws:
HibernateException

find

public List find(String query,
                 Object value,
                 Type type)
          throws HibernateException
Description copied from interface: Session
Execute a query with bind parameters. Bind a value to a "?" parameter in the query string.

Specified by:
find in interface Session
Parameters:
query - the query string
value - a value to be bound to a "?" placeholder (JDBC IN parameter).
type - the Hibernate type of the value
Returns:
a distinct list of instances (or arrays of instances)
Throws:
HibernateException
See Also:
for access to Type instances

find

public List find(String query,
                 Object[] values,
                 Type[] types)
          throws HibernateException
Description copied from interface: Session
Execute a query with bind parameters. Binding an array of values to "?" parameters in the query string.

Specified by:
find in interface Session
Parameters:
query - the query string
values - an array of values to be bound to the "?" placeholders (JDBC IN parameters).
types - an array of Hibernate types of the values
Returns:
a distinct list of instances
Throws:
HibernateException
See Also:
for access to Type instances

iterate

public Iterator iterate(String query)
                 throws HibernateException
Description copied from interface: Session
Execute a query and return the results in an iterator. If the query has multiple return values, values will be returned in an array of type Object[].

Entities returned as results are initialized on demand. The first SQL query returns identifiers only. So iterate() is usually a less efficient way to retrieve objects than find().

Specified by:
iterate in interface Session
Parameters:
query - the query string
Returns:
an iterator
Throws:
HibernateException

iterate

public Iterator iterate(String query,
                        Object value,
                        Type type)
                 throws HibernateException
Description copied from interface: Session
Execute a query and return the results in an iterator. Write the given value to "?" in the query string. If the query has multiple return values, values will be returned in an array of type Object[].

Entities returned as results are initialized on demand. The first SQL query returns identifiers only. So iterate() is usually a less efficient way to retrieve objects than find().

Specified by:
iterate in interface Session
Parameters:
query - the query string
value - a value to be witten to a "?" placeholder in the query string
type - the hibernate type of value
Returns:
an iterator
Throws:
HibernateException

iterate

public Iterator iterate(String query,
                        Object[] values,
                        Type[] types)
                 throws HibernateException
Description copied from interface: Session
Execute a query and return the results in an iterator. Write the given values to "?" in the query string. If the query has multiple return values, values will be returned in an array of type Object[].

Entities returned as results are initialized on demand. The first SQL query returns identifiers only. So iterate() is usually a less efficient way to retrieve objects than find().

Specified by:
iterate in interface Session
Parameters:
query - the query string
values - a list of values to be written to "?" placeholders in the query
types - a list of Hibernate types of the values
Returns:
an iterator
Throws:
HibernateException

filter

public Collection filter(Object collection,
                         String filter)
                  throws HibernateException
Description copied from interface: Session
Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to this, the collection element. Filters allow efficient access to very large lazy collections. (Executing the filter does not initialize the collection.)

Specified by:
filter in interface Session
Parameters:
collection - a persistent collection to filter
filter - a filter query string
Returns:
Collection the resulting collection
Throws:
HibernateException

filter

public Collection filter(Object collection,
                         String filter,
                         Object value,
                         Type type)
                  throws HibernateException
Description copied from interface: Session
Apply a filter to a persistent collection. A filter is a Hibernate query that may refer to this, the collection element.

Specified by:
filter in interface Session
Parameters:
collection - a persistent collection to filter
filter - a filter query string
value - a value to be witten to a "?" placeholder in the query string
type - the hibernate type of value
Returns:
Collection
Throws:
HibernateException

filter

public Collection filter(Object collection,
                         String filter,
                         Object[] values,
                         Type[] types)
                  throws HibernateException
Description copied from interface: Session
Apply a filter to a persistent collection. Bind the given parameters to "?" placeholders. A filter is a Hibernate query that may refer to this, the collection element.

Specified by:
filter in interface Session
Parameters:
collection - a persistent collection to filter
filter - a filter query string
values - a list of values to be written to "?" placeholders in the query
types - a list of Hibernate types of the values
Returns:
Collection
Throws:
HibernateException

delete

public int delete(String query)
           throws HibernateException
Description copied from interface: Session
Delete all objects returned by the query. Return the number of objects deleted.

Specified by:
delete in interface Session
Parameters:
query - the query string
Returns:
the number of instances deleted
Throws:
HibernateException

delete

public int delete(String query,
                  Object value,
                  Type type)
           throws HibernateException
Description copied from interface: Session
Delete all objects returned by the query. Return the number of objects deleted.

Specified by:
delete in interface Session
Parameters:
query - the query string
value - a value to be witten to a "?" placeholder in the query string.
type - the hibernate type of value.
Returns:
the number of instances deleted
Throws:
HibernateException

delete

public int delete(String query,
                  Object[] values,
                  Type[] types)
           throws HibernateException
Description copied from interface: Session
Delete all objects returned by the query. Return the number of objects deleted.

Specified by:
delete in interface Session
Parameters:
query - the query string
values - a list of values to be written to "?" placeholders in the query.
types - a list of Hibernate types of the values
Returns:
the number of instances deleted
Throws:
HibernateException

lock

public void lock(Object object,
                 LockMode lockMode)
          throws HibernateException
Description copied from interface: Session
Obtain the specified lock level upon the given object. This may be used to perform a version check (LockMode.READ), to upgrade to a pessimistic lock (LockMode.UPGRADE), or to simply reassociate a transient instance with a session (LockMode.NONE).

Specified by:
lock in interface Session
Parameters:
object - a persistent or transient instance
lockMode - the lock level
Throws:
HibernateException

refresh

public void refresh(Object object)
             throws HibernateException
Description copied from interface: Session
Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example
  • where a database trigger alters the object state upon insert or update
  • after executing direct SQL (eg. a mass update) in the same session
  • after inserting a Blob or Clob

Specified by:
refresh in interface Session
Parameters:
object - a persistent or transient instance
Throws:
HibernateException

getCurrentLockMode

public LockMode getCurrentLockMode(Object object)
                            throws HibernateException
Description copied from interface: Session
Determine the current lock mode of the given object.

Specified by:
getCurrentLockMode in interface Session
Parameters:
object - a persistent instance
Returns:
the current lock mode
Throws:
HibernateException

beginTransaction

public Transaction beginTransaction()
                             throws HibernateException
Description copied from interface: Session
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. The class of the returned Transaction object is determined by the property hibernate.transaction_factory.

Specified by:
beginTransaction in interface Session
Returns:
a Transaction instance
Throws:
HibernateException
See Also:
Transaction

createQuery

public Query createQuery(String queryString)
                  throws HibernateException
Description copied from interface: Session
Create a new instance of Query for the given query string.

Specified by:
createQuery in interface Session
Parameters:
queryString - a Hibernate query
Returns:
Query
Throws:
HibernateException

createFilter

public Query createFilter(Object collection,
                          String queryString)
                   throws HibernateException
Description copied from interface: Session
Create a new instance of Query for the given collection and filter string.

Specified by:
createFilter in interface Session
Parameters:
collection - a persistent collection
queryString - a Hibernate query
Returns:
Query
Throws:
HibernateException

getNamedQuery

public Query getNamedQuery(String queryName)
                    throws HibernateException
Description copied from interface: Session
Obtain an instance of Query for a named query string defined in the mapping file.

Specified by:
getNamedQuery in interface Session
Parameters:
queryName - the name of a query defined externally
Returns:
Query
Throws:
HibernateException

createCriteria

public Criteria createCriteria(Class persistentClass)
Description copied from interface: Session
Create a new Criteria instance, for the given entity class.

Specified by:
createCriteria in interface Session
Parameters:
persistentClass -
Returns:
Criteria

refresh

public void refresh(Object object,
                    LockMode lockMode)
             throws HibernateException
Description copied from interface: Session
Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.

Specified by:
refresh in interface Session
Parameters:
object - a persistent or transient instance
lockMode - the lock mode to use
Throws:
HibernateException

contains

public boolean contains(Object object)
Description copied from interface: Session
Check if this instance is associated with this Session.

Specified by:
contains in interface Session
Parameters:
object - an instance of a persistent class
Returns:
true if the given instance is associated with this Session

evict

public void evict(Object object)
           throws HibernateException
Description copied from interface: Session
Remove this instance from the session cache. Changes to the instance will not be synchronized with the database. This operation cascades to associated instances if the association is mapped with cascade="all" or cascade="all-delete-orphan".

Specified by:
evict in interface Session
Parameters:
object - a persistent instance
Throws:
HibernateException

createSQLQuery

public Query createSQLQuery(String string,
                            String returnAlias,
                            Class returnClass)
Description copied from interface: Session
Create a new instance of Query for the given SQL string.

Specified by:
createSQLQuery in interface Session
Parameters:
string - a query expressed in SQL
returnAlias - a table alias that appears inside {} in the SQL string
returnClass - the returned persistent class

createSQLQuery

public Query createSQLQuery(String string,
                            String[] returnAliases,
                            Class[] returnClasses)
Description copied from interface: Session
Create a new instance of Query for the given SQL string.

Specified by:
createSQLQuery in interface Session
Parameters:
string - a query expressed in SQL
returnAliases - an array of table aliases that appear inside {} in the SQL string
returnClasses - the returned persistent classes

clear

public void clear()
Description copied from interface: Session
Completely clear the session. Evict all loaded instances and cancel all pending saves, updates and deletions. Do not close open iterators or instances of ScrollableResults.

Specified by:
clear in interface Session

get

public Object get(Class clazz,
                  Serializable id,
                  LockMode lockMode)
           throws HibernateException
Description copied from interface: Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. Obtain the specified lock mode if the instance exists.

Specified by:
get in interface Session
Parameters:
clazz - a persistent class
id - an identifier
lockMode - the lock mode
Returns:
a persistent instance or null
Throws:
HibernateException

get

public Object get(Class clazz,
                  Serializable id)
           throws HibernateException
Description copied from interface: Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance, or a proxy for the instance, is already associated with the session, return that instance or proxy.)

Specified by:
get in interface Session
Parameters:
clazz - a persistent class
id - an identifier
Returns:
a persistent instance or null
Throws:
HibernateException

replicate

public void replicate(Object object,
                      ReplicationMode mode)
               throws HibernateException
Description copied from interface: Session
Persist all reachable transient objects, reusing the current identifier values. Note that this will not trigger the Interceptor of the Session.

Specified by:
replicate in interface Session
Parameters:
object - a transient instance of a persistent class
Throws:
HibernateException

getSessionFactory

public SessionFactory getSessionFactory()
Description copied from interface: Session
Get the SessionFactory that created this instance.

Specified by:
getSessionFactory in interface Session
See Also:
SessionFactory

cancelQuery

public void cancelQuery()
                 throws HibernateException
Description copied from interface: Session
Cancel execution of the current query. May be called from one thread to stop execution of a query in another thread. Use with care!

Specified by:
cancelQuery in interface Session
Throws:
HibernateException

saveOrUpdateCopy

public Object saveOrUpdateCopy(Object object)
                        throws HibernateException
Description copied from interface: Session
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved or does not exist in the database, save it and return it as a newly persistent instance. Otherwise, the given instance does not become associated with the session.

Specified by:
saveOrUpdateCopy in interface Session
Parameters:
object - a transient instance with state to be copied
Returns:
an updated persistent instance
Throws:
HibernateException

saveOrUpdateCopy

public Object saveOrUpdateCopy(Object object,
                               Serializable id)
                        throws HibernateException
Description copied from interface: Session
Copy the state of the given object onto the persistent object with the given identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If there is no database row with the given identifier, save the given instance and return it as a newly persistent instance. Otherwise, the given instance does not become associated with the session.

Specified by:
saveOrUpdateCopy in interface Session
Parameters:
object - a persistent or transient instance with state to be copied
id - the identifier of the instance to copy to
Returns:
an updated persistent instance
Throws:
HibernateException

isDirty

public boolean isDirty()
                throws HibernateException
Description copied from interface: Session
Does this Session contain any changes which must be synchronized with the database? Would any SQL be executed if we flushed this session?

Specified by:
isDirty in interface Session
Returns:
boolean
Throws:
HibernateException