01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19: package org.apache.openjpa.persistence;
20:
21: import javax.persistence.EntityTransaction;
22:
23: /**
24: * Extension of the JPA {@link EntityTransaction} interface.
25: *
26: * @since 1.0.0
27: * @published
28: */
29: public interface OpenJPAEntityTransaction extends EntityTransaction {
30:
31: /**
32: * Issue a commit and then start a new transaction. This is identical to:
33: * <pre> manager.commit (); manager.begin ();
34: * </pre> except that the entity manager's internal atomic lock is utilized,
35: * so this method can be safely executed from multiple threads.
36: *
37: * @see javax.persistence.EntityTransaction#commit()
38: * @see javax.persistence.EntityTransaction#begin()
39: */
40: public void commitAndResume();
41:
42: /**
43: * Issue a rollback and then start a new transaction. This is identical to:
44: * <pre> manager.rollback (); manager.begin ();
45: * </pre> except that the entity manager's internal atomic lock is utilized,
46: * so this method can be safely executed from multiple threads.
47: *
48: * @see javax.persistence.EntityTransaction#rollback()
49: * @see javax.persistence.EntityTransaction#begin()
50: */
51: public void rollbackAndResume();
52:
53: /**
54: * Mark the current transaction for rollback with the specified cause
55: * of the rollback.
56: *
57: * @since 0.9.7
58: */
59: public void setRollbackOnly(Throwable cause);
60:
61: /**
62: * Returns the Throwable that caused the transaction to be
63: * marked for rollback.
64: *
65: * @return the Throwable, or null if none was given
66: *
67: * @since 0.9.7
68: */
69: public Throwable getRollbackCause();
70: }
|