net.sqlind
Class SQLQueryMapper.SQLQueryHandler

java.lang.Object
  extended by net.sqlind.SQLQueryMapper.SQLQueryHandler
Enclosing class:
SQLQueryMapper

public class SQLQueryMapper.SQLQueryHandler
extends Object

Handle a query execution context


Nested Class Summary
 class SQLQueryMapper.SQLQueryHandler.BeanListWiringBehavior<T>
          Generic query result bean list wiring implementation.
 class SQLQueryMapper.SQLQueryHandler.BeanWiringBehavior<T>
          Generic query result bean wiring implementation
 class SQLQueryMapper.SQLQueryHandler.ResultSetFecthedBehaviour
          Generic query result set fetching implementation
 class SQLQueryMapper.SQLQueryHandler.SingleBeanListWiringBehavior<T>
          Generic query result bean list wiring implementation.
 
Method Summary
 void close()
          Close the query context
 void fillInParametersFromBean(Object bean)
          Try to set the value of query parameters using the given bean
 String getInjectedSQL()
           
 List<SQLQueryMapper.InjectPoint> getInjectPoints()
           
<T> T
getSingleResult(Connection cnx)
          Perform a query and return a single result from the first record
 String getSQL()
           
 String getSQLWithParameters()
           
 void performSelectQuery(Connection cnx, SQLQueryMapper.QueryBehavior behaviour)
          Perform a select over DB using current query definition.
 void performUpdateQuery(Connection cnx)
          Perform an update over DB using current query definition.
 void setInjection(String injectPointId, String value)
          Map a value to a given insert point.
 void setParameter(String paramId, Object value)
          Map a value to the given parameter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInjectPoints

public List<SQLQueryMapper.InjectPoint> getInjectPoints()
Returns:
the list of insert points of the query.

getSingleResult

public <T> T getSingleResult(Connection cnx)
                  throws SQLQueryMapper.SQLMapperException
Perform a query and return a single result from the first record

Parameters:
cnx - the DB connection instance
Throws:
SQLQueryMapper.SQLMapperException

performUpdateQuery

public void performUpdateQuery(Connection cnx)
                        throws SQLQueryMapper.SQLMapperException
Perform an update over DB using current query definition.

Parameters:
cnx - the DB connection instance
Throws:
SQLQueryMapper.SQLMapperException

performSelectQuery

public void performSelectQuery(Connection cnx,
                               SQLQueryMapper.QueryBehavior behaviour)
                        throws SQLQueryMapper.SQLMapperException
Perform a select over DB using current query definition.

Parameters:
cnx - the DB connection instance
Throws:
SQLQueryMapper.SQLMapperException

getSQLWithParameters

public String getSQLWithParameters()
Returns:
the sql query string with valued parameters.

close

public void close()
Close the query context


setParameter

public void setParameter(String paramId,
                         Object value)
                  throws SQLQueryMapper.SQLMapperException
Map a value to the given parameter

Parameters:
paramId -
value -
Throws:
SQLQueryMapper.SQLMapperException

setInjection

public void setInjection(String injectPointId,
                         String value)
                  throws SQLQueryMapper.SQLMapperException
Map a value to a given insert point.

Parameters:
injectPointId -
value -
Throws:
SQLQueryMapper.SQLMapperException

getSQL

public String getSQL()
Returns:
the query string before injection

getInjectedSQL

public String getInjectedSQL()
Returns:
the query string after injection

fillInParametersFromBean

public void fillInParametersFromBean(Object bean)
                              throws SQLQueryMapper.SQLMapperException
Try to set the value of query parameters using the given bean

Parameters:
bean -
Throws:
SQLQueryMapper.SQLMapperException


Copyright © 2011. All Rights Reserved.