4 ms·
Populating objects isn't the hardest part, but it's the most useful part. Writing object populating code is tedious, copy-pasty and uncool. And having that, yo
by ilyak 17y ago
Populating objects isn't the hardest part, but it's the most useful part.
Writing object populating code is tedious, copy-pasty and uncool.
And having that, you don't really need ORM, naive or not.
- bokonist 17y agoIf 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.