Hello, Thanks for your suggestion. The topic of how such mapping strategies could be implemented has been discussed a couple of times on this user group, e.g. here: https://groups.google.com/forum/?fromgroups=#!topic/jooq-user/Bi9ODgSOWfw
As a general rule of thumb, I have concluded that jOOQ should not prioritise mapping efforts and custom strategies over its core task: SQL abstraction. Instead, you could use other tools, such as - http://modelmapper.org - http://orika-mapper.github.io/orika-docs If you're using any of the above tools, you can wrap them in a jOOQ RecordMapper to let them interact with jOOQ: - http://www.jooq.org/javadoc/latest/org/jooq/RecordMapper.html - http://www.jooq.org/doc/3.0/manual/sql-execution/fetching/recordmapper/ Of course, your idea seems quite reasonable at first sight. As far as I know, it is being implemented in another product called JIRM: http://github.com/agentgt/jirm Maybe, you could extract some ideas from there and implement them in a jOOQ RecordMapper contribution? Cheers Lukas 2013/4/18 <[email protected]>: > I felt it appropriate to discuss with you the following idea: > > We have the following Java classes (getters and setters are ommitted): > > class Person { > Integer id; > String name; > Byte sexId; > Date birthDate; > Person couple; > List<Person children; > } > > class Home { > Integer id; > String address; > } > > And we have the following SQL query: > > select > PERSON.id, > PERSON.name > PERSON.sex_id as 'sexId', > COUPLE.name as 'couple.name', > COUPLE.sex_id as 'couple.sexId', > HOME.id as 'couple.home.id', > HOME.address as 'couple.home.address', > CHILDREN.id as 'children[].id', > CHILDREN.name as 'children[].name' > from > Person PERSON > left outer join > Person COUPLE > on COUPLE.id = PERSON.couple_id > left outer join > Home HOME > on HOME.id = COUPLE.home_id > left outer join > Person_children PC > on PC.person_id = PERSON.id > inner join > Person CHILDREN > on CHILDREN.id = PC.son_id > where > PERSON.sex_id <> COUPLE.sex_id and > (PERSON.birth_date between ? and ?) and > (COUPLE.birth_date between ? and ?) > order by > PERSON.id asc > > It would be nice that JOOQ to have a mechanism to take that query, > issue it against the database, traverse the JDBC ResultSet, and > create and populate a Java object tree thanks to the column alias. > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
