Tx connections are always read-write.

This commit is contained in:
Michael Bayne
2014-10-01 11:29:45 -07:00
parent 90e45a4ad1
commit 1a822593fb
3 changed files with 15 additions and 18 deletions
@@ -66,21 +66,21 @@ public interface ConnectionProvider
void connectionFailed (String ident, boolean readOnly, Connection conn, SQLException error); void connectionFailed (String ident, boolean readOnly, Connection conn, SQLException error);
/** /**
* Returns a connection that can be used in a transaction. See {@link #getConnection}. * Returns a connection that can be used in a transaction. See {@link #getConnection}. Note:
* transaction connections are never read-only. What would be the point?
*/ */
Connection getTxConnection (String ident, boolean readOnly) Connection getTxConnection (String ident) throws PersistenceException;
throws PersistenceException;
/** /**
* Releases a connection obtained by {@link #getTxConnection}. See {@link #releaseConnection}. * Releases a connection obtained by {@link #getTxConnection}. See {@link #releaseConnection}.
*/ */
void releaseTxConnection (String ident, boolean readOnly, Connection conn); void releaseTxConnection (String ident, Connection conn);
/** /**
* Reports failure of a connection obtained by {@link #getTxConnection}. See {@link * Reports failure of a connection obtained by {@link #getTxConnection}. See {@link
* #connectionFailed}. * #connectionFailed}.
*/ */
void txConnectionFailed (String ident, boolean readOnly, Connection conn, SQLException error); void txConnectionFailed (String ident, Connection conn, SQLException error);
/** /**
* Returns the URL associated with this database identifier. This should be the same value that * Returns the URL associated with this database identifier. This should be the same value that
@@ -80,26 +80,24 @@ public class DataSourceConnectionProvider implements ConnectionProvider
} }
// from ConnectionProvider // from ConnectionProvider
public Connection getTxConnection (String ident, boolean readOnly) public Connection getTxConnection (String ident) throws PersistenceException
throws PersistenceException
{ {
// our connections are pooled, so we can just get them normally // our connections are pooled, so we can just get them normally
return getConnection(ident, readOnly); return getConnection(ident, false);
} }
// from ConnectionProvider // from ConnectionProvider
public void releaseTxConnection (String ident, boolean readOnly, Connection conn) public void releaseTxConnection (String ident, Connection conn)
{ {
// our connections are pooled, so we can just release them normally // our connections are pooled, so we can just release them normally
releaseConnection(ident, readOnly, conn); releaseConnection(ident, false, conn);
} }
// from ConnectionProvider // from ConnectionProvider
public void txConnectionFailed (String ident, boolean readOnly, Connection conn, public void txConnectionFailed (String ident, Connection conn, SQLException error)
SQLException error)
{ {
// our connections are pooled, so we can just fail them normally // our connections are pooled, so we can just fail them normally
connectionFailed(ident, readOnly, conn, error); connectionFailed(ident, false, conn, error);
} }
// from ConnectionProvider // from ConnectionProvider
@@ -128,20 +128,19 @@ public class StaticConnectionProvider implements ConnectionProvider
} }
// from ConnectionProvider // from ConnectionProvider
public Connection getTxConnection (String ident, boolean readOnly) throws PersistenceException public Connection getTxConnection (String ident) throws PersistenceException
{ {
return getMapping(ident, readOnly).openConnection(ident, null); return getMapping(ident, false).openConnection(ident, null);
} }
// from ConnectionProvider // from ConnectionProvider
public void releaseTxConnection (String ident, boolean readOnly, Connection conn) public void releaseTxConnection (String ident, Connection conn)
{ {
close(conn, ident); close(conn, ident);
} }
// from ConnectionProvider // from ConnectionProvider
public void txConnectionFailed ( public void txConnectionFailed (String ident, Connection conn, SQLException error)
String ident, boolean readOnly, Connection conn, SQLException error)
{ {
close(conn, ident); close(conn, ident);
} }