Java Doc for Transaction.java in  » Database-ORM » db-ojb » org » odmg » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » db ojb » org.odmg 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.odmg.Transaction

All known Subclasses:   org.apache.ojb.odmg.TransactionImpl,
Transaction
public interface Transaction (Code)
This interfaces provides the operations necessary to perform database transactions. All access, creation, and modification of persistent objects and their fields must be done within a transaction. Before performing any database operations, a thread must explicitly create a transaction object or associate itself with an existing transaction object (by calling join), and that transaction must be open (through a call to begin). All subsequent operations by the thread, including reads, writes, and lock acquisitions, are done under the thread’s current transaction.

A thread may only operate on its current transaction. For example, a TransactionNotInProgressException is thrown if a thread attempts to begin, commit, checkpoint, or abort a transaction prior to joining itself to that transaction.

A transaction is either open or closed. A transaction is open if a call has been made to begin, but no call has been made to commit or abort. Once commit or abort is called, the transaction is closed. The method isOpen can be called to determine the state of the transaction.

Read locks are implicitly obtained on objects as they are accessed. Write locks are implicitly obtained as objects are modified. Transaction objects are transient, they cannot be stored in the database.
author:
   David Jordan (as Java Editor of the Object Data Management Group)
version:
   ODMG 3.0
See Also:   TransactionNotInProgressException



Field Summary
final public static  intREAD
     Read lock mode.
final public static  intUPGRADE
     Upgrade lock mode.
final public static  intWRITE
     Write lock mode.


Method Summary
public  voidabort()
     Abort and close the transaction.
public  voidbegin()
     Start a transaction. Calling begin multiple times on the same transaction object, without an intervening call to commit or abort, causes the exception TransactionInProgressException to be thrown on the second and subsequent calls.
public  voidcheckpoint()
     Commit the transaction, but reopen the transaction, retaining all locks.
public  voidcommit()
     Commit and close the transaction. Calling commit commits to the database all persistent object modifications within the transaction and releases any locks held by the transaction. A persistent object modification is an update of any field of an existing persistent object, or an update or creation of a new named object in the database. If a persistent object modification results in a reference from an existing persistent object to a transient object, the transient object is moved to the database, and all references to it updated accordingly.
public  booleanisOpen()
     Determine whether the transaction is open or not.
public  voidjoin()
     Attach the caller's thread to this Transaction and detach the thread from any former Transaction the thread may have been associated with.
public  voidleave()
     Detach the caller's thread from this Transaction, but do not attach the thread to another Transaction.
public  voidlock(Object obj, int lockMode)
     Upgrade the lock on the given object to the given lock mode. The call has no effect if the object's current lock is already at or above that level of lock mode.
Parameters:
  obj - The object to acquire a lock on.
Parameters:
  lockMode - The lock mode to acquire.
public  booleantryLock(Object obj, int lockMode)
     Upgrade the lock on the given object to the given lock mode. Method tryLock is the same as lock except it returns a boolean indicating whether the lock was granted instead of generating an exception.
Parameters:
  obj - The object to acquire a lock on.
Parameters:
  lockMode - The lock mode to acquire.

Field Detail
READ
final public static int READ(Code)
Read lock mode.



UPGRADE
final public static int UPGRADE(Code)
Upgrade lock mode.



WRITE
final public static int WRITE(Code)
Write lock mode.





Method Detail
abort
public void abort()(Code)
Abort and close the transaction. Calling abort abandons all persistent object modifications and releases the associated locks. Aborting a transaction does not restore the state of modified transient objects



begin
public void begin()(Code)
Start a transaction. Calling begin multiple times on the same transaction object, without an intervening call to commit or abort, causes the exception TransactionInProgressException to be thrown on the second and subsequent calls. Operations executed before a transaction has been opened, or before reopening after a transaction is aborted or committed, have undefined results; these may throw a TransactionNotInProgressException exception.



checkpoint
public void checkpoint()(Code)
Commit the transaction, but reopen the transaction, retaining all locks. Calling checkpoint commits persistent object modifications made within the transaction since the last checkpoint to the database. The transaction retains all locks it held on those objects at the time the checkpoint was invoked.



commit
public void commit()(Code)
Commit and close the transaction. Calling commit commits to the database all persistent object modifications within the transaction and releases any locks held by the transaction. A persistent object modification is an update of any field of an existing persistent object, or an update or creation of a new named object in the database. If a persistent object modification results in a reference from an existing persistent object to a transient object, the transient object is moved to the database, and all references to it updated accordingly. Note that the act of moving a transient object to the database may create still more persistent references to transient objects, so its referents must be examined and moved as well. This process continues until the database contains no references to transient objects, a condition that is guaranteed as part of transaction commit. Committing a transaction does not remove from memory transient objects created during the transaction



isOpen
public boolean isOpen()(Code)
Determine whether the transaction is open or not. A transaction is open if a call has been made to begin, but a subsequent call to either commit or abort has not been made. True if the transaction is open, otherwise false.



join
public void join()(Code)
Attach the caller's thread to this Transaction and detach the thread from any former Transaction the thread may have been associated with.



leave
public void leave()(Code)
Detach the caller's thread from this Transaction, but do not attach the thread to another Transaction.



lock
public void lock(Object obj, int lockMode) throws LockNotGrantedException(Code)
Upgrade the lock on the given object to the given lock mode. The call has no effect if the object's current lock is already at or above that level of lock mode.
Parameters:
  obj - The object to acquire a lock on.
Parameters:
  lockMode - The lock mode to acquire. The lock modes are READ,UPGRADE, and WRITE.
exception:
  LockNotGrantedException - Is thrown if the given lock mode could not be acquired.



tryLock
public boolean tryLock(Object obj, int lockMode)(Code)
Upgrade the lock on the given object to the given lock mode. Method tryLock is the same as lock except it returns a boolean indicating whether the lock was granted instead of generating an exception.
Parameters:
  obj - The object to acquire a lock on.
Parameters:
  lockMode - The lock mode to acquire. The lock modes are READ,UPGRADE, and WRITE. True if the lock has been acquired, otherwise false.



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.