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

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


net.sf.hibernate.odmg
Class Transaction

java.lang.Object
  extended bynet.sf.hibernate.odmg.Transaction
All Implemented Interfaces:
org.odmg.Transaction

public class Transaction
extends Object
implements org.odmg.Transaction

Implements the ODMG Transaction API.


Field Summary
 
Fields inherited from interface org.odmg.Transaction
READ, UPGRADE, WRITE
 
Constructor Summary
Transaction()
          Instantiate a Transaction for a Database created by the current thread.
Transaction(org.odmg.Database database)
          Instantiate a Transaction for the given Database.
 
Method Summary
 void abort()
          Abort the transaction.
 void begin()
          Begin the transaction.
 void checkpoint()
          Commit the changes, but leave the transaction open.
 void commit()
          Commit the transaction.
 Session getSession()
          Get the underlying Hibernate Session.
 boolean isOpen()
          Is the transaction open.
 void join()
          Associate the current thread with this Transaction.
 void leave()
          Disassociate the thread the Transaction.
 void lock(Object obj, int lockMode)
          Obtain a lock upon the given object.
 boolean tryLock(Object obj, int lockMode)
          Not implemented.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction(org.odmg.Database database)
            throws org.odmg.ODMGException
Instantiate a Transaction for the given Database.


Transaction

public Transaction()
            throws org.odmg.ODMGException
Instantiate a Transaction for a Database created by the current thread.

Method Detail

getSession

public Session getSession()
Get the underlying Hibernate Session. (Very useful!)


join

public void join()
Associate the current thread with this Transaction. Disassociate the thread from any other Transaction.

Specified by:
join in interface org.odmg.Transaction
See Also:
Transaction.join()

leave

public void leave()
Disassociate the thread the Transaction. JavaDoc requires a second sentence.

Specified by:
leave in interface org.odmg.Transaction
See Also:
Transaction.leave()

begin

public void begin()
Begin the transaction. JavaDoc requires a second sentence.

Specified by:
begin in interface org.odmg.Transaction
See Also:
Transaction.begin()

isOpen

public boolean isOpen()
Is the transaction open. Returns true if begin() was called but neither commit() nor abort() was called.

Specified by:
isOpen in interface org.odmg.Transaction
See Also:
Transaction.isOpen()

commit

public void commit()
Commit the transaction. JavaDoc requires a second sentence.

Specified by:
commit in interface org.odmg.Transaction
See Also:
Transaction.commit()

abort

public void abort()
Abort the transaction. JavaDoc requires a second sentence.

Specified by:
abort in interface org.odmg.Transaction
See Also:
Transaction.abort()

checkpoint

public void checkpoint()
Commit the changes, but leave the transaction open. This implementation does not have quite the same semantics os ODMG (locks are not retained). So you should only use this with versioned data.

Specified by:
checkpoint in interface org.odmg.Transaction
See Also:
Transaction.checkpoint()

lock

public void lock(Object obj,
                 int lockMode)
          throws org.odmg.LockNotGrantedException
Obtain a lock upon the given object. In the present implementation, READ lock mode is ignored while UPGRADE and WRITE lock modes obtain an UPGRADE lock for databases which support for update. We should improve this eventually....

Specified by:
lock in interface org.odmg.Transaction
Throws:
org.odmg.LockNotGrantedException
See Also:
Transaction.lock(Object, int)

tryLock

public boolean tryLock(Object obj,
                       int lockMode)
Not implemented. JavaDoc requires a second sentence.

Specified by:
tryLock in interface org.odmg.Transaction
See Also:
Transaction.tryLock(Object, int)