Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix JPA Transaction#commit() does not throw RollbacackException
- Loading branch information
Showing
12 changed files
with
435 additions
and
639 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
hibernate-core/src/main/java/org/hibernate/engine/spi/ExceptionConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,56 @@ | |||
/* | |||
* Hibernate, Relational Persistence for Idiomatic Java | |||
* | |||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | |||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>. | |||
*/ | |||
package org.hibernate.engine.spi; | |||
|
|||
import java.sql.SQLException; | |||
|
|||
import org.hibernate.HibernateException; | |||
import org.hibernate.JDBCException; | |||
import org.hibernate.LockOptions; | |||
|
|||
/** | |||
* @author Andrea Boriero | |||
*/ | |||
public interface ExceptionConverter { | |||
/** | |||
* Converts the exception thrown during the transaction commit phase | |||
* | |||
* @param e The exception being handled | |||
* | |||
* @return The converted exception | |||
*/ | |||
RuntimeException convertCommitException(RuntimeException e); | |||
|
|||
/** | |||
* Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA sepcification makes use | |||
* of exceptions outside its exception hierarchy, though they are all runtime exceptions. | |||
* <p/> | |||
* | |||
* @param e The Hibernate excepton. | |||
* @param lockOptions The lock options in effect at the time of exception (can be null) | |||
* | |||
* @return The JPA-specified exception | |||
*/ | |||
RuntimeException convert(HibernateException e, LockOptions lockOptions); | |||
|
|||
/** | |||
* Converts a Hibernate-specific exception into a JPA-specified exception; note that the JPA sepcification makes use | |||
* of exceptions outside its exception hierarchy, though they are all runtime exceptions. | |||
* <p/> | |||
* | |||
* @param e The Hibernate excepton. | |||
* | |||
* @return The JPA-specified exception | |||
*/ | |||
RuntimeException convert(HibernateException e); | |||
|
|||
RuntimeException convert(RuntimeException e); | |||
|
|||
RuntimeException convert(RuntimeException e, LockOptions lockOptions); | |||
|
|||
JDBCException convert(SQLException e, String message); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.