com.agimatec.sql.query
Class JdbcQueryUtil
java.lang.Object
com.agimatec.sql.query.JdbcExecutor
com.agimatec.sql.query.JdbcQueryUtil
- All Implemented Interfaces:
- Serializable
public class JdbcQueryUtil
- extends JdbcExecutor
- implements 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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
connection
protected final Connection connection
sqlBuilder
protected final SQLBuilder sqlBuilder
log
protected static final org.apache.commons.logging.Log log
JdbcQueryUtil
public JdbcQueryUtil(Connection aConnection,
SQLBuilder aSqlBuilder)
- Use StoreQueryBeanBuilder.create() instead of this constructor!
getConnection
public Connection getConnection()
- Specified by:
getConnection in class JdbcExecutor
getSqlBuilder
public SQLBuilder getSqlBuilder()
executeUpdate
public int executeUpdate(QueryDefinition updateDefinition)
throws 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:
SQLException
executeCount
public int executeCount(QueryDefinition queryDefinition)
throws 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:
Exception
executeQuery
public QueryResult executeQuery(QueryDefinition queryDefinition)
throws 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:
Exception
SQLException
Copyright © 2008-2011. All Rights Reserved.