mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#992 - API Change - Change Transaction.close() to throw PersistenceException rather than IOException
This commit is contained in:
@@ -5,13 +5,12 @@ import io.ebean.config.DocStoreConfig;
|
||||
import io.ebean.config.ServerConfig;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
import java.io.Closeable;
|
||||
import java.sql.Connection;
|
||||
|
||||
/**
|
||||
* The Transaction object. Typically representing a JDBC or JTA transaction.
|
||||
*/
|
||||
public interface Transaction extends Closeable {
|
||||
public interface Transaction extends AutoCloseable {
|
||||
|
||||
/**
|
||||
* Read Committed transaction isolation. Same as
|
||||
@@ -124,7 +123,13 @@ public interface Transaction extends Closeable {
|
||||
/**
|
||||
* If the transaction is active then perform rollback. Otherwise do nothing.
|
||||
*/
|
||||
void end() throws PersistenceException;
|
||||
void end();
|
||||
|
||||
|
||||
/**
|
||||
* Synonym for end() to support AutoClosable.
|
||||
*/
|
||||
void close();
|
||||
|
||||
/**
|
||||
* Return true if the transaction is active.
|
||||
|
||||
@@ -411,7 +411,7 @@ public class ScopedTransaction implements SpiTransaction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
public void close() {
|
||||
transaction.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1144,11 +1144,7 @@ public class JdbcTransaction implements SpiTransaction {
|
||||
* Alias for end(), which enables this class to be used in try-with-resources.
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
end();
|
||||
} catch (PersistenceException ex) {
|
||||
throw new IOException(ex);
|
||||
}
|
||||
public void close() {
|
||||
end();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user