Hello Henning, Unfortunately, this isn't possible out of the box, right now. It sounds like a very nice idea, though. I have registered feature request #1969 for this. https://github.com/jOOQ/jOOQ/issues/1969
Of course, you can always write actual database views and let the code generator generate meta-data for those. Also, you could manually implement some org.jooq.Table objects, but that might be quite a bit of work. There are CustomTable types, which unfortunately aren't as powerful as you would like to see them: http://www.jooq.org/doc/2.6/manual/sql-building/queryparts/custom-queryparts/ This is due to the methods toSQL() and bind() being final in CustomTable's class hierarchy, which is probably a design flaw. It should be fixed in jOOQ 3.0 as of #1970: https://github.com/jOOQ/jOOQ/issues/1970 Cheers Lukas 2012/11/16 Henning Blohm <[email protected]>: > Hi, > > I am trying to achieve the construction of a (logical) view using jOOQ. As a > simple case, assume there is a table students with name and age and I want > to turn this into > > minors = select s.name as minor_name from students s where s.age<21; > > Some other piece of code can then filter those further as in > > select m.minor_name from minors where m.minor_name='smith'; > > In Java terms, "minors" would be a typed "queryable" with a custom POJO type > (with field "minorName"). > > Real world examples would be more complex of course > > I spent some time looking for a suitable construct in jOOQ but was not > succesful. > > Any helpful directions would be great! > > Thanks, > Henning
