The previous class is a part of the framework I've developed ages ago
being inspired by the way Spring improved working with jdbc.
It manages resources such as connections, resultsets, statements and
provide you with the ability to make most common queries easily for
example:
if you want to perform update your code might look like that:
BigInteger objectID = new BigInteger("123455");
jdbc.executeUpdate("update nc_objects set name = ? where object_id
= ?", "NewName", objectID);
selecting list of integers:
List childIDs = jdbc.selectForList("select object_id from
nc_objects where parent_id = ?",
JDBCTypeConverters.NUMBER_CONVERTER, new Object[][]
{{parentID}});
working with a result set:
Integer orderNumber = new Integer("...");
Integer result = jdbc.executeSelect("select * from nc_objects
where parent_id = ? and order_number = ?",
parentId, orderNumber, new
ResultSetHandler<Integer>(){
public Integer onResultSet(ResultSet resultSet) throws
SQLException {
// work with result set here ...
while (resultSet.next()) {//...
}
return 1;
}
});


|