JdbcResourceRegistry (Hibernate JavaDocs)
Date: 2012-04-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.engine.jdbc.spi
Interface JdbcResourceRegistry

All Superinterfaces:
  Serializable

All Known Implementing Classes:
  JdbcResourceRegistryImpl

    public interface JdbcResourceRegistry

extends Serializable

Defines a registry of JDBC resources related to a particular unit of work. The main function of a JdbcResourceRegistry is to make sure resources get cleaned up. This is accomplished by registering all JDBC-related resources via the `register(java.sql.Statement)` and `register(java.sql.ResultSet)` methods. When done with these resources, they should be released by the corollary `release(java.sql.Statement)` and `release(java.sql.ResultSet)` methods. Any un-released resources will be released automatically when this registry is closed via `close()`. Additionally, all registered resources can be released at any time using `releaseResources()`.

Additionally, a query can be registered as being able to be cancelled via the `registerLastQuery(java.sql.Statement)` method. Such statements can then be cancelled by calling `cancelLastQuery()`

Method Summary
`void` | `cancelLastQuery()` Cancel the last query registered via `registerLastQuery(java.sql.Statement)`
`void` | `close()` Close this registry.
`boolean` | `hasRegisteredResources()` Does this registry currently have any registered resources?
`void` | `register(ResultSet resultSet)` Register a JDBC result set.
`void` | `register(Statement statement)` Register a JDBC statement.
`void` | `registerLastQuery(Statement statement)` Register a query statement as being able to be cancelled.
`void` | `release(ResultSet resultSet)` Release a previously registered result set.
`void` | `release(Statement statement)` Release a previously registered statement.
`void` | `releaseResources()` Release all registered resources.

Method Detail

### register

    void register(Statement statement)

  Register a JDBC statement.

  Parameters:
    `statement` - The statement to register.

### release

    void release(Statement statement)

  Release a previously registered statement.

  Parameters:
    `statement` - The statement to release.

### register

    void register(ResultSet resultSet)

  Register a JDBC result set.

  Parameters:
    `resultSet` - The result set to register.

### release

    void release(ResultSet resultSet)

  Release a previously registered result set.

  Parameters:
    `resultSet` - The result set to release.

### hasRegisteredResources

    boolean hasRegisteredResources()

  Does this registry currently have any registered resources?

  Returns:
    True if the registry does have registered resources; false otherwise.

### releaseResources

    void releaseResources()

  Release all registered resources.

### close

    void close()

  Close this registry. Also `releases` any registered resources.

  After execution, the registry is considered unusable.

### registerLastQuery

    void registerLastQuery(Statement statement)

  Register a query statement as being able to be cancelled.

  Parameters:
    `statement` - The cancel-able query statement.

### cancelLastQuery

    void cancelLastQuery()

  Cancel the last query registered via `registerLastQuery(java.sql.Statement)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.