com.agimatec.sql.query
Class JdbcQueryUtil
java.lang.Object
com.agimatec.sql.query.JdbcExecutor
com.agimatec.sql.query.JdbcQueryUtil
- All Implemented Interfaces:
- java.io.Serializable
public class JdbcQueryUtil
- extends JdbcExecutor
- implements java.io.Serializable
Helper class, that implements some general methods for query processing.
This class offers serveral interfaces with APIs for easy
query execution, SQL-generation/execution etc.
See interfaces for details.
(This class could be used anywhere outside an EJB environment.)
- See Also:
- Serialized Form
|
Constructor Summary |
JdbcQueryUtil(java.sql.Connection aConnection,
SQLBuilder aSqlBuilder)
Use StoreQueryBeanBuilder.create() instead of this constructor! |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
connection
protected final java.sql.Connection connection
sqlBuilder
protected final SQLBuilder sqlBuilder
log
protected static final org.apache.commons.logging.Log log
JdbcQueryUtil
public JdbcQueryUtil(java.sql.Connection aConnection,
SQLBuilder aSqlBuilder)
- Use StoreQueryBeanBuilder.create() instead of this constructor!
getConnection
public java.sql.Connection getConnection()
- Specified by:
getConnection in class JdbcExecutor
getSqlBuilder
public SQLBuilder getSqlBuilder()
executeUpdate
public int executeUpdate(QueryDefinition updateDefinition)
throws java.sql.SQLException
- execute a insert, update or delete statement.
- Returns:
- either the row count for INSERT, UPDATE or DELETE statements,
or 0 for SQL statements that return nothing
- Throws:
java.sql.SQLException
executeCount
public int executeCount(QueryDefinition queryDefinition)
throws java.lang.Exception
- Convenience method -
Execute a Query that returns ONE Row with one int value.
Useful for executing SELECT COUNT(*) statements.
- Returns:
- the int value of the first column, first row in the answer set.
if the answer set is empty, return -1.
- Throws:
java.lang.Exception
executeQuery
public QueryResult executeQuery(QueryDefinition queryDefinition)
throws java.sql.SQLException
- execute a select statement returning objects build by
the result visitor.
The default result objects are of type Object[], one for each row in the resultset.
- Parameters:
queryDefinition - object containing the query specification
- Returns:
- the lookupresult containing the results loaded
- Throws:
java.lang.Exception
java.sql.SQLException
Copyright © 2008-2012. All Rights Reserved.