## org.hibernate.jdbc
Class WorkExecutor<T>

    java.lang.Object
      org.hibernate.jdbc.WorkExecutor<T>

    public class WorkExecutor<T>

extends Object

A visitor used for executing a discrete piece of work encapsulated in a `Work` or `ReturningWork` instance..

Constructor Summary
`WorkExecutor()`

Method Summary

`

`<T> T`

`

`executeReturningWork(ReturningWork<T> work, Connection connection)`
Execute the discrete work encapsulated by a `ReturningWork` instance using the supplied connection, returning the result of `ReturningWork.execute(java.sql.Connection)`

`

`<T> T`

`

`executeWork(Work work, Connection connection)`
Execute the discrete work encapsulated by a `Work` instance using the supplied connection.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### WorkExecutor

    public WorkExecutor()

Method Detail

### executeWork

    public <T> T executeWork(Work work,
                             Connection connection)
                  throws SQLException

  Execute the discrete work encapsulated by a `Work` instance using the supplied connection. Because `Work` does not return a value when executed (via `Work.execute(java.sql.Connection)`, this method always returns null.

  Parameters:
    `work` - The @link ReturningWork} instance encapsulating the discrete work
    `connection` - The connection on which to perform the work.
  Returns:
    null>.
  Throws:
    `SQLException` - Thrown during execution of the underlying JDBC interaction.
    `HibernateException` - Generally indicates a wrapped SQLException.

### executeReturningWork

    public <T> T executeReturningWork(ReturningWork<T> work,
                                      Connection connection)
                           throws SQLException

  Execute the discrete work encapsulated by a `ReturningWork` instance using the supplied connection, returning the result of `ReturningWork.execute(java.sql.Connection)`

  Parameters:
    `work` - The @link ReturningWork} instance encapsulating the discrete work
    `connection` - The connection on which to perform the work.
  Returns:
    the valued returned by `work.execute(connection)`.
  Throws:
    `SQLException` - Thrown during execution of the underlying JDBC interaction.
    `HibernateException` - Generally indicates a wrapped SQLException.

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