Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



This is not enough: you should also set up references to other objects (by id) and deal with underscore_database_names vs camelCaseJavaNames.


And include a singular<->plural mapping for column and table names.


...via setting. But that last is trivial. Just add it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: