Package org.datanucleus.api.jdo
Class JDOConnectionJDBCImpl
java.lang.Object
org.datanucleus.api.jdo.JDOConnectionImpl
org.datanucleus.api.jdo.JDOConnectionJDBCImpl
- All Implemented Interfaces:
AutoCloseable
,Connection
,Wrapper
,javax.jdo.datastore.JDOConnection
Implementation of a JDO connection that is also a wrapper for "java.sql.Connection".
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Connection
The JDBC connection (shortcut for the native connection of the NucleusConnection).private boolean
whether this connection is available to the developerFields inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
nucConn
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Constructor Summary
ConstructorsConstructorDescriptionJDOConnectionJDBCImpl
(org.datanucleus.store.NucleusConnection nconn) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
Assert the JDOConnection is available.void
Method to clear warnings from the connection.void
commit()
Method to commit the connection.createArrayOf
(String typeName, Object[] elements) Accessor for a statement.createStatement
(int resultSetType, int resultSetConcurrency) Accessor for a statement.createStatement
(int resultSetType, int resultSetConcurrency, int resultSetHoldability) Accessor for a statement.createStruct
(String typeName, Object[] attributes) boolean
Accessor for the autocommit setting.Accessor for the catalog.getClientInfo
(String name) int
Access the holdability of the connection.Accessor for the database metadata.int
int
Accessor for the transaction isolation level.Accessor for the type map.Accessor for the warnings.boolean
boolean
isClosed()
Accessor for whether the connection is closed.boolean
Accessor for whether the connection is read only.boolean
isValid
(int timeout) boolean
isWrapperFor
(Class iface) Accessor for using native SQL.prepareCall
(String sql) prepareCall
(String sql, int resultSetType, int resultSetConcurrency) prepareCall
(String arg0, int arg1, int arg2, int arg3) prepareStatement
(String sql) prepareStatement
(String arg0, int arg1) prepareStatement
(String arg0, int[] arg1) prepareStatement
(String sql, int resultSetType, int resultSetConcurrency) prepareStatement
(String arg0, int arg1, int arg2, int arg3) prepareStatement
(String arg0, String[] arg1) void
Mutator to release the savepoint.void
rollback()
Method to rollback the connection.void
Mutator to rollback the savepoint.void
setAutoCommit
(boolean autoCommit) Method to set the autocommit for the connection.void
setCatalog
(String catalog) Mutator for the catalogvoid
setClientInfo
(String name, String value) void
setClientInfo
(Properties properties) void
setHoldability
(int holdability) Method to set the holdability for the connection.void
setNetworkTimeout
(Executor executor, int milliseconds) void
setReadOnly
(boolean readOnly) Method to set the read-only nature for the connection.Mutator to set the savepoint.setSavepoint
(String arg0) void
void
setTransactionIsolation
(int level) Method to set the transaction isolation for the connection.void
setTypeMap
(Map map) Method to set the type map<T> T
Methods inherited from class org.datanucleus.api.jdo.JDOConnectionImpl
close, getNativeConnection, throwExceptionNotAvailable, throwExceptionUnsupportedOperation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.sql.Connection
beginRequest, close, endRequest, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
Field Details
-
conn
The JDBC connection (shortcut for the native connection of the NucleusConnection). -
isAvailable
private boolean isAvailablewhether this connection is available to the developer
-
-
Constructor Details
-
JDOConnectionJDBCImpl
public JDOConnectionJDBCImpl(org.datanucleus.store.NucleusConnection nconn) Constructor.- Parameters:
nconn
- The Nucleus Connection delegate
-
-
Method Details
-
isAvailable
public boolean isAvailable() -
getHoldability
Access the holdability of the connection.- Specified by:
getHoldability
in interfaceConnection
- Returns:
- The holdability
- Throws:
SQLException
- if there is a problem
-
getTransactionIsolation
Accessor for the transaction isolation level.- Specified by:
getTransactionIsolation
in interfaceConnection
- Returns:
- The isolation level
- Throws:
SQLException
- if there is a problem
-
clearWarnings
Method to clear warnings from the connection.- Specified by:
clearWarnings
in interfaceConnection
- Throws:
SQLException
- thrown if there is a problem
-
commit
Method to commit the connection.- Specified by:
commit
in interfaceConnection
- Throws:
SQLException
- thrown if an error occurs.
-
rollback
Method to rollback the connection.- Specified by:
rollback
in interfaceConnection
- Throws:
SQLException
- thrown if an error occurs.
-
getAutoCommit
Accessor for the autocommit setting.- Specified by:
getAutoCommit
in interfaceConnection
- Returns:
- Whether to autocommit
- Throws:
SQLException
- thrown if an error occurs.
-
isClosed
Accessor for whether the connection is closed.- Specified by:
isClosed
in interfaceConnection
- Returns:
- Whether it is closed.
- Throws:
SQLException
- thrown if an error occurs.
-
isReadOnly
Accessor for whether the connection is read only.- Specified by:
isReadOnly
in interfaceConnection
- Returns:
- Whether it is read only.
- Throws:
SQLException
- thrown if an error occurs.
-
setHoldability
Method to set the holdability for the connection.- Specified by:
setHoldability
in interfaceConnection
- Parameters:
holdability
- The holdability- Throws:
SQLException
- thrown if an error occurs.
-
setTransactionIsolation
Method to set the transaction isolation for the connection.- Specified by:
setTransactionIsolation
in interfaceConnection
- Parameters:
level
- The transaction isolation- Throws:
SQLException
- thrown if an error occurs.
-
setAutoCommit
Method to set the autocommit for the connection.- Specified by:
setAutoCommit
in interfaceConnection
- Parameters:
autoCommit
- Whether to autocommit- Throws:
SQLException
- thrown if an error occurs.
-
setReadOnly
Method to set the read-only nature for the connection.- Specified by:
setReadOnly
in interfaceConnection
- Parameters:
readOnly
- whether it is read-only- Throws:
SQLException
- thrown if an error occurs.
-
getCatalog
Accessor for the catalog.- Specified by:
getCatalog
in interfaceConnection
- Returns:
- The catalog
- Throws:
SQLException
- Thrown if an error occurs
-
setCatalog
Mutator for the catalog- Specified by:
setCatalog
in interfaceConnection
- Parameters:
catalog
- The catalog- Throws:
SQLException
- Thrown if an error occurs
-
getMetaData
Accessor for the database metadata.- Specified by:
getMetaData
in interfaceConnection
- Returns:
- The database metadata
- Throws:
SQLException
- Thrown if an error occurs
-
getWarnings
Accessor for the warnings.- Specified by:
getWarnings
in interfaceConnection
- Returns:
- The warnings
- Throws:
SQLException
- Thrown if an error occurs
-
setSavepoint
Mutator to set the savepoint.- Specified by:
setSavepoint
in interfaceConnection
- Returns:
- The savepoint
- Throws:
SQLException
- Thrown if an error occurs
-
releaseSavepoint
Mutator to release the savepoint.- Specified by:
releaseSavepoint
in interfaceConnection
- Parameters:
pt
- The savepoint- Throws:
SQLException
- Thrown if an error occurs
-
rollback
Mutator to rollback the savepoint.- Specified by:
rollback
in interfaceConnection
- Parameters:
pt
- The savepoint- Throws:
SQLException
- Thrown if an error occurs
-
createStatement
Accessor for a statement.- Specified by:
createStatement
in interfaceConnection
- Returns:
- The statement
- Throws:
SQLException
- Thrown if an error occurs
-
createStatement
Accessor for a statement.- Specified by:
createStatement
in interfaceConnection
- Parameters:
resultSetType
- type of resultsresultSetConcurrency
- The concurrency- Returns:
- The statement
- Throws:
SQLException
- Thrown if an error occurs
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException Accessor for a statement.- Specified by:
createStatement
in interfaceConnection
- Parameters:
resultSetType
- type of resultsresultSetConcurrency
- The concurrencyresultSetHoldability
- The holdability- Returns:
- The statement
- Throws:
SQLException
- Thrown if an error occurs
-
getTypeMap
Accessor for the type map.- Specified by:
getTypeMap
in interfaceConnection
- Returns:
- The type map
- Throws:
SQLException
- Thrown if an error occurs
-
setTypeMap
Method to set the type map- Specified by:
setTypeMap
in interfaceConnection
- Parameters:
map
- The type map- Throws:
SQLException
- Thrown if an error occurs
-
nativeSQL
Accessor for using native SQL.- Specified by:
nativeSQL
in interfaceConnection
- Parameters:
sql
- The sql- Returns:
- The native SQL
- Throws:
SQLException
- Thrown if an error occurs
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCall
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String arg0, int arg1, int arg2, int arg3) throws SQLException - Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepoint
in interfaceConnection
- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatement
in interfaceConnection
- Throws:
SQLException
-
assertAvailable
public void assertAvailable()Assert the JDOConnection is available. Throws a JDOException if not available -
createArrayOf
- Specified by:
createArrayOf
in interfaceConnection
- Throws:
SQLException
-
createBlob
- Specified by:
createBlob
in interfaceConnection
- Throws:
SQLException
-
createClob
- Specified by:
createClob
in interfaceConnection
- Throws:
SQLException
-
createStruct
- Specified by:
createStruct
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
getClientInfo
- Specified by:
getClientInfo
in interfaceConnection
- Throws:
SQLException
-
isValid
- Specified by:
isValid
in interfaceConnection
- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
setClientInfo
- Specified by:
setClientInfo
in interfaceConnection
- Throws:
SQLClientInfoException
-
createNClob
- Specified by:
createNClob
in interfaceConnection
- Throws:
SQLException
-
createSQLXML
- Specified by:
createSQLXML
in interfaceConnection
- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
setSchema
- Specified by:
setSchema
in interfaceConnection
- Throws:
SQLException
-
getSchema
- Specified by:
getSchema
in interfaceConnection
- Throws:
SQLException
-
abort
- Specified by:
abort
in interfaceConnection
- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-
getNetworkTimeout
- Specified by:
getNetworkTimeout
in interfaceConnection
- Throws:
SQLException
-