Package org.hibernate.testing.orm.jdbc
Class PreparedStatementSpyConnectionProvider
java.lang.Object
org.hibernate.testing.jdbc.ConnectionProviderDelegate
org.hibernate.testing.orm.jdbc.PreparedStatementSpyConnectionProvider
- All Implemented Interfaces:
Serializable,org.hibernate.engine.jdbc.connections.spi.ConnectionProvider,org.hibernate.service.Service,org.hibernate.service.spi.Configurable,org.hibernate.service.spi.ServiceRegistryAwareService,org.hibernate.service.spi.Stoppable,org.hibernate.service.spi.Wrapped
This
ConnectionProvider extends any other ConnectionProvider that would be used by default taken the current configuration properties, and it
intercept the underlying PreparedStatement method calls.- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPreparedStatementSpyConnectionProvider(boolean forceSupportsAggressiveRelease) -
Method Summary
Modifier and TypeMethodDescriptionprotected Connectionvoidclear()Clears the recorded PreparedStatements and reset the associated Mocks.voidcloseConnection(Connection connection) Get a list of current acquired Connections.Get the SQL statements that were executed since the last clear operation.Get the SQL update statements that were executed since the last clear operation.Get the PreparedStatements SQL statements.Get one and only one PreparedStatement associated to the given SQL statement.Get the PreparedStatements that were executed since the last clear operation.Get the PreparedStatements that are associated to the following SQL statement.Get a list of current released Connections.voidstop()Methods inherited from class org.hibernate.testing.jdbc.ConnectionProviderDelegate
configure, getConnectionProvider, getDatabaseConnectionInfo, getDatabaseConnectionInfo, injectServices, isUnwrappableAs, setConnectionProvider, supportsAggressiveRelease, unwrap
-
Field Details
-
spyContext
-
-
Constructor Details
-
PreparedStatementSpyConnectionProvider
public PreparedStatementSpyConnectionProvider() -
PreparedStatementSpyConnectionProvider
public PreparedStatementSpyConnectionProvider(boolean forceSupportsAggressiveRelease)
-
-
Method Details
-
actualConnection
- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider- Overrides:
getConnectionin classConnectionProviderDelegate- Throws:
SQLException
-
closeConnection
- Specified by:
closeConnectionin interfaceorg.hibernate.engine.jdbc.connections.spi.ConnectionProvider- Overrides:
closeConnectionin classConnectionProviderDelegate- Throws:
SQLException
-
stop
public void stop()- Specified by:
stopin interfaceorg.hibernate.service.spi.Stoppable- Overrides:
stopin classConnectionProviderDelegate
-
clear
public void clear()Clears the recorded PreparedStatements and reset the associated Mocks. -
getPreparedStatement
Get one and only one PreparedStatement associated to the given SQL statement.- Parameters:
sql- SQL statement.- Returns:
- matching PreparedStatement.
- Throws:
IllegalArgumentException- If there is no matching PreparedStatement or multiple instances, an exception is being thrown.
-
getPreparedStatements
Get the PreparedStatements that are associated to the following SQL statement.- Parameters:
sql- SQL statement.- Returns:
- list of recorded PreparedStatements matching the SQL statement.
-
getPreparedStatements
Get the PreparedStatements that were executed since the last clear operation.- Returns:
- list of recorded PreparedStatements.
-
getPreparedStatementsAndSql
- Returns:
- the PreparedStatements that were executed since the last clear operation, along with each statement's corresponding SQL.
-
getPreparedSQLStatements
Get the PreparedStatements SQL statements.- Returns:
- list of recorded PreparedStatements SQL statements.
-
getExecuteStatements
Get the SQL statements that were executed since the last clear operation.- Returns:
- list of recorded update statements.
-
getExecuteUpdateStatements
Get the SQL update statements that were executed since the last clear operation.- Returns:
- list of recorded update statements.
-
getAcquiredConnections
Get a list of current acquired Connections.- Returns:
- list of current acquired Connections
-
getReleasedConnections
Get a list of current released Connections.- Returns:
- list of current released Connections
-