5 ms·
If you're in Java, just use BeanResultHandler. We use helper functions that simply wrap the low level queries using beanhandler. So all my queries end up look
by bokonist 17y ago
If you're in Java, just use BeanResultHandler. We use helper functions that simply wrap the low level queries using beanhandler. So all my queries end up looking like:
List<MyObject> myobjects = dbUtils.select("SELECT name,age FROM (some complex query ... )", params, MyObject.class)
BeanHandler will automatically fill any property in MyObject with a column of a matching name from the select statement.
- ilyak 17y agoThis is not enough: you should also set up references to other objects (by id) and deal with underscore_database_names vs camelCaseJavaNames.
- randallsquared 17y ago...via setting. But that last is trivial. Just add it.
- thwarted 17y agoAnd include a singular<->plural mapping for column and table names.