Java Reference
In-Depth Information
Method Description
enableFilter() Enables a named filter in queries produced by createFilter() .
disableFilter() Disables a named filter.
getEnabledFilter() Retrieves a currently enabled filter object.
createQuery() Creates a Hibernate query to be applied to the database.
getNamedQuery() Retrieves a query from the mapping file.
cancelQuery() Cancels execution of any query currently in progress from another thread.
createCriteria() Creates a criteria object for narrowing search results.
Transactions and Locking
beginTransaction()
Begins a transaction.
getTransaction()
Retrieves the current transaction object. This does not return null when
no transaction is in progress. Instead, the active property of the returned
object is false .
lock()
Gets a database lock for an object (or can be used like persist() if
LockMode.NONE is given).
Managing Resources
contains()
Determines whether a specific object is associated with the database.
clear()
Clears the session of all loaded instances and cancels any saves, updates,
or deletions that have not been completed. Retains any iterators that are
in use.
evict()
Disassociates an object from the session so that subsequent changes to it
will not be persisted.
flush()
Flushes all pending changes into the database—all saves, updates, and
deletions will be carried out; essentially, this synchronizes the session with
the database.
isOpen()
Determines whether the session has been closed.
isDirty()
Determines whether the session is synchronized with the database.
getCacheMode()
Determines the caching mode currently employed.
setCacheMode()
Changes the caching mode currently employed.
getCurrentLockMode()
Determines the locking mode currently employed.
setFlushMode()
Determines the approach to flushing currently used. The options are to
flush after every operation, flush when needed, never flush, or flush only
on commit.
setReadOnly()
Marks a persistent object as read-only (or as writable). There are minor
performance benefits from marking an object as read-only, but changes to
its state will be ignored until it is marked as writable.
close()
Closes the session, and hence, the underlying database connection;
releases other resources (such as the cache). You must not perform opera-
tions on the Session object after calling close() .
getSessionFactory()
Retrieves a reference to the SessionFactory object that created the current
Session instance.
The JDBC Connection
connection()
Retrieves a reference to the underlying database connection.
disconnect()
Disconnects the underlying database connection.
reconnect()
Reconnects the underlying database connection.
isConnected()
Determines whether the underlying database connection is connected.
Search WWH ::




Custom Search