Interface StatementFactory

All Known Implementing Classes:

public interface StatementFactory

Created by Pavel Syrtsov Date: Nov 3, 2007 Time: 8:16:33 PM

StatementFactory interface defines ability of the object to: create prepared statment and bind all necessary parameters to it. When this factory object created framework will initialize it with method setup Then it will be used to create JDBC prepared statement and bind to it arguments data objects if any. To define what implementation class shall be used to construct statement for Dao use annotation UseStatementFactory

Method Summary
 java.sql.PreparedStatement createStatement(java.sql.Connection connection, java.lang.Object[] args)
          Creates new PreparedStatement according to definition given in setup.
 void init(java.lang.String sql, java.lang.reflect.Method method)
          Initializes factory object with query data

Method Detail


void init(java.lang.String sql,
          java.lang.reflect.Method method)
          throws StatementFactoryException
Initializes factory object with query data

sql - - query text
method - - method that quey will be attached to
StatementFactoryException - - throws excpetion if fails to parse query


java.sql.PreparedStatement createStatement(java.sql.Connection connection,
                                           java.lang.Object[] args)
                                           throws StatementFactoryException
Creates new PreparedStatement according to definition given in setup. This method implementation has to be thread safe.

connection - - JDBC connection to be used to create new statement
args - - parameters values to bind to prepared statement
PreparedStatement instance ready to be executed
StatementFactoryException - if it fails to create and initialize prepared statement