lumis.portal.dao.hibernate
Class TransactionHibernate

Package class diagram package TransactionHibernate
java.lang.Object
  extended by lumis.portal.dao.hibernate.TransactionHibernate
All Implemented Interfaces:
ITransactionHibernate, ITransactionJdbc, ITransaction

public class TransactionHibernate
extends Object
implements ITransactionHibernate

Implements a transaction object

Since:
4.0.0

Constructor Summary
TransactionHibernate()
           
 
Method Summary
 boolean addObserver(ITransactionObserver observer)
          Adds an observer for this transaction.
 void begin()
           
 void commit()
           
 void dispose()
           
protected  void finalize()
           
 Object getAttribute(String name)
          Returns the value of the named attribute, or null if no attribute of the given name exists.
 long getBeginTimeMillis()
          Returns the time when this transaction began in milliseconds since January 1, 1970 UTC.
 ITransaction getByConnectionId(String id)
          Returns an ITransaction that represents the same transaction but that returns the connection with the given id as default.
 Connection getConnection()
          Returns the default jdbc connection for this transaction.
 Connection getConnection(String databaseId)
          Returns the jdbc connection associated with the specified id.
 org.hibernate.Session getSession()
          Returns the default hibernate session for this transaction.
 org.hibernate.Session getSession(String databaseId)
          Returns the hibernate session associated with the specified database.
 boolean isActive()
          Returns true if the transaction is currently active, false otherwise.
 void removeAttribute(String name)
          Removes an attribute from this transaction.
 boolean removeObserver(ITransactionObserver observer)
          Removes an observer for this transaction.
 void rollback()
           
 void setAttribute(String name, Object value)
          Stores an attribute in this transaction.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionHibernate

public TransactionHibernate()
Method Detail

getSession

public org.hibernate.Session getSession()
                                 throws DaoException
Description copied from interface: ITransactionHibernate
Returns the default hibernate session for this transaction.

Specified by:
getSession in interface ITransactionHibernate
Returns:
the default hibernate session for this transaction.
Throws:
DaoException

getSession

public org.hibernate.Session getSession(String databaseId)
                                 throws DaoException
Description copied from interface: ITransactionHibernate
Returns the hibernate session associated with the specified database.

Specified by:
getSession in interface ITransactionHibernate
Parameters:
databaseId - the database id.
Returns:
the hibernate session.
Throws:
DaoException

dispose

public void dispose()
             throws DaoException
Specified by:
dispose in interface ITransaction
Throws:
DaoException

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

isActive

public boolean isActive()
Description copied from interface: ITransaction
Returns true if the transaction is currently active, false otherwise.

Specified by:
isActive in interface ITransaction
Returns:
true if the transaction is currently active, false otherwise.

begin

public void begin()
           throws DaoException
Specified by:
begin in interface ITransaction
Throws:
DaoException

commit

public void commit()
            throws DaoException
Specified by:
commit in interface ITransaction
Throws:
DaoException

rollback

public void rollback()
              throws DaoException
Specified by:
rollback in interface ITransaction
Throws:
DaoException

getConnection

public Connection getConnection()
                         throws DaoException
Description copied from interface: ITransactionJdbc
Returns the default jdbc connection for this transaction.

Specified by:
getConnection in interface ITransactionJdbc
Returns:
the default jdbc connection for this transaction.
Throws:
DaoException

getConnection

public Connection getConnection(String databaseId)
                         throws DaoException
Description copied from interface: ITransactionJdbc
Returns the jdbc connection associated with the specified id.

Specified by:
getConnection in interface ITransactionJdbc
Parameters:
databaseId - the connection id.
Returns:
the jdbc connection.
Throws:
DaoException

getByConnectionId

public ITransaction getByConnectionId(String id)
                               throws DaoException
Description copied from interface: ITransaction
Returns an ITransaction that represents the same transaction but that returns the connection with the given id as default. How the id represents the connection is defined by the concrete class that implements this interface.

Specified by:
getByConnectionId in interface ITransaction
Parameters:
id - the connection id.
Returns:
the ITransaction object.
Throws:
DaoException

addObserver

public boolean addObserver(ITransactionObserver observer)
                    throws PortalException
Description copied from interface: ITransaction
Adds an observer for this transaction. The observer is added only if the current observer list does not already contain it.

Specified by:
addObserver in interface ITransaction
Parameters:
observer - the observer.
Returns:
true if the observer was added, false otherwise.
Throws:
PortalException

removeObserver

public boolean removeObserver(ITransactionObserver observer)
                       throws PortalException
Description copied from interface: ITransaction
Removes an observer for this transaction. If the current observer list does not contain the given observer nothing happens.

Specified by:
removeObserver in interface ITransaction
Parameters:
observer - the observer.
Returns:
true if the observer was removed, false otherwise.
Throws:
PortalException

getBeginTimeMillis

public long getBeginTimeMillis()
Returns the time when this transaction began in milliseconds since January 1, 1970 UTC.

Returns:
the time when this transaction began in milliseconds since January 1, 1970 UTC; or zero if this transaction is not active.
Since:
4.1.0

getAttribute

public Object getAttribute(String name)
Description copied from interface: ITransaction
Returns the value of the named attribute, or null if no attribute of the given name exists.

Different transaction instances that refer to the same transaction (see ITransaction.getByConnectionId(String)) share the same attributes.

Specified by:
getAttribute in interface ITransaction
Parameters:
name - the name of the attribute.
Returns:
the value of the attribute, or null if the attribute does not exist.

setAttribute

public void setAttribute(String name,
                         Object value)
Description copied from interface: ITransaction
Stores an attribute in this transaction. If the value passed in is null, the effect is the same as calling ITransaction.removeAttribute(String).

Specified by:
setAttribute in interface ITransaction
Parameters:
name - the name of the attribute.
value - the value to be stored.

removeAttribute

public void removeAttribute(String name)
Description copied from interface: ITransaction
Removes an attribute from this transaction.

Specified by:
removeAttribute in interface ITransaction
Parameters:
name - the name of the attribute.


Lumisportal  4.1.0.071221 - Copyright © 2001-2007, Lumis. All Rights Reserved.