Class AbstractTransactionalQuery
- java.lang.Object
-
- com.vaadin.v7.data.util.sqlcontainer.query.AbstractTransactionalQuery
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
FreeformQuery,TableQuery
@Deprecated public abstract class AbstractTransactionalQuery extends Object implements Serializable
Deprecated.As of 8.0, no replacement available.Common base class for database query classes that handle connections and transactions.- Since:
- 6.8.9
- Author:
- Vaadin Ltd
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbeginTransaction()Deprecated.Reserves a connection with auto-commit off if no transaction is in progress.voidcommit()Deprecated.Commits (if not in auto-commit mode) and releases the active connection.protected voidensureTransaction()Deprecated.Check that a transaction is active.protected ConnectiongetConnection()Deprecated.Returns the currently active connection, reserves and returns a new connection if no active connection.protected booleanisInTransaction()Deprecated.protected voidreleaseConnection(Connection conn, Statement statement, ResultSet rs)Deprecated.Closes a statement and a resultset, then releases the connection if it is not part of an active transaction.voidrollback()Deprecated.Rolls back and releases the active connection.
-
-
-
Method Detail
-
beginTransaction
public void beginTransaction() throws UnsupportedOperationException, SQLExceptionDeprecated.Reserves a connection with auto-commit off if no transaction is in progress.- Throws:
IllegalStateException- if a transaction is already openSQLException- if a connection could not be obtained or configuredUnsupportedOperationException
-
commit
public void commit() throws UnsupportedOperationException, SQLExceptionDeprecated.Commits (if not in auto-commit mode) and releases the active connection.- Throws:
SQLException- if not in a transaction managed by this queryUnsupportedOperationException
-
rollback
public void rollback() throws UnsupportedOperationException, SQLExceptionDeprecated.Rolls back and releases the active connection.- Throws:
SQLException- if not in a transaction managed by this queryUnsupportedOperationException
-
ensureTransaction
protected void ensureTransaction() throws SQLExceptionDeprecated.Check that a transaction is active.- Throws:
SQLException- if no active transaction
-
releaseConnection
protected void releaseConnection(Connection conn, Statement statement, ResultSet rs) throws SQLException
Deprecated.Closes a statement and a resultset, then releases the connection if it is not part of an active transaction. A failure in closing one of the parameters does not prevent closing the rest. If the statement is aPreparedStatement, its parameters are cleared prior to closing the statement. Although JDBC specification does state that closing a statement closes its result set and closing a connection closes statements and result sets, this method does try to close the result set and statement explicitly whenever not null. This can guard against bugs in certain JDBC drivers and reduce leaks in case e.g. closing the result set succeeds but closing the statement or connection fails.- Parameters:
conn- the connection to releasestatement- the statement to close, may be null to skip closingrs- the result set to close, may be null to skip closing- Throws:
SQLException- if closing the result set or the statement fails
-
getConnection
protected Connection getConnection() throws SQLException
Deprecated.Returns the currently active connection, reserves and returns a new connection if no active connection.- Returns:
- previously active or newly reserved connection
- Throws:
SQLException
-
isInTransaction
protected boolean isInTransaction()
Deprecated.
-
-