com.subshell.persistence.hibernate
Class HibernateTransaction

java.lang.Object
  extended by com.subshell.persistence.hibernate.HibernateTransaction
All Implemented Interfaces:
Transaction

public class HibernateTransaction
extends Object
implements Transaction

Transaction implementation using Hibernate.


Method Summary
 void commit()
          Commits this Transaction.
<T> Serializable
create(T o)
          Creates an object in the database.
<T> void
delete(T o)
          Deletes a persistent object from the database.
 org.hibernate.Session getSession()
          Returns this HibernateTransaction's internal Session.
 boolean isCommitted()
          Returns whether this Transaction has been committed/rolled back.
<T> boolean
isPersistent(T o)
          Returns whether an object is persistent.
<T> T
load(Class<T> clazz, Serializable id)
          Loads an object from the database.
 void rollback()
          Rolls back this Transaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

load

public <T> T load(Class<T> clazz,
                  Serializable id)
       throws PersistenceException
Description copied from interface: Transaction
Loads an object from the database.

Specified by:
load in interface Transaction
Parameters:
clazz - the object's class
id - the object's ID
Throws:
PersistenceException - when loading the object fails

create

public <T> Serializable create(T o)
                    throws PersistenceException
Description copied from interface: Transaction
Creates an object in the database.

Specified by:
create in interface Transaction
Parameters:
o - the object to create
Returns:
the identifier that has been assigned to the created object
Throws:
PersistenceException - when creating the object fails

delete

public <T> void delete(T o)
            throws PersistenceException
Description copied from interface: Transaction
Deletes a persistent object from the database.

Specified by:
delete in interface Transaction
Parameters:
o - the object to delete
Throws:
PersistenceException - when deleting the object fails

isPersistent

public <T> boolean isPersistent(T o)
                     throws PersistenceException
Description copied from interface: Transaction
Returns whether an object is persistent.

Specified by:
isPersistent in interface Transaction
Throws:
PersistenceException - when there is a persistence-related error

commit

public void commit()
            throws PersistenceException
Description copied from interface: Transaction
Commits this Transaction. The Transaction cannot be reused once it has been committed.

Specified by:
commit in interface Transaction
Throws:
PersistenceException - when committing this Transaction fails

rollback

public void rollback()
              throws PersistenceException
Description copied from interface: Transaction
Rolls back this Transaction. The Transaction cannot be reused once it has been rolled back.

Specified by:
rollback in interface Transaction
Throws:
PersistenceException - when rolling back this Transaction fails

isCommitted

public boolean isCommitted()
Description copied from interface: Transaction
Returns whether this Transaction has been committed/rolled back.

Specified by:
isCommitted in interface Transaction

getSession

public org.hibernate.Session getSession()
                                 throws org.hibernate.HibernateException,
                                        PersistenceException
Returns this HibernateTransaction's internal Session. This method should be used by persistence mappers only.

Throws:
org.hibernate.HibernateException
PersistenceException


Copyright © 2004-2005 subshell GmbH. All Rights Reserved.