Subversion Repositories WebE

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
33 PointedEar 1
//$Id: EntityTransaction.java 11282 2007-03-14 22:05:59Z epbernard $
2
package javax.persistence;
3
 
4
/**
5
 * The EntityTransaction interface is used to control resource transactions
6
 * on resource-local entity managers. The EntityManager.getTransaction()
7
 * method returns the EntityTransaction interface.
8
 *
9
 * @author Emmanuel Bernard
10
 */
11
public interface EntityTransaction {
12
        /**
13
         * Start a resource transaction.
14
         *
15
         * @throws IllegalStateException if isActive() is true.
16
         */
17
        public void begin();
18
 
19
        /**
20
         * Commit the current transaction, writing any unflushed
21
         * changes to the database.
22
         *
23
         * @throws IllegalStateException if isActive() is false.
24
         * @throws RollbackException     if the commit fails.
25
         */
26
        public void commit();
27
 
28
        /**
29
         * Roll back the current transaction.
30
         *
31
         * @throws IllegalStateException if isActive() is false.
32
         * @throws PersistenceException  if an unexpected error
33
         *                               condition is encountered.
34
         */
35
        public void rollback();
36
 
37
        /**
38
         * Mark the current transaction so that the only possible
39
         * outcome of the transaction is for the transaction to be
40
         * rolled back.
41
         *
42
         * @throws IllegalStateException if isActive() is false.
43
         */
44
        public void setRollbackOnly();
45
 
46
        /**
47
         * Determine whether the current transaction has been marked
48
         * for rollback.
49
         *
50
         * @throws IllegalStateException if isActive() is false.
51
         */
52
        public boolean getRollbackOnly();
53
 
54
        /**
55
         * Indicate whether a transaction is in progress.
56
         * @throws PersistenceException if an unexpected error
57
         * condition is encountered.
58
         */
59
        public boolean isActive();
60
}