Hi Digulla, 

Sorry for the top post, but I think this is the best way I can answer your 
question with the limited knowledge I have about JOOQ.

I think there a few parts to answer your question.

Firstly, I'm not aware of JOOQ 2.6 producing a catalog when it introspects your 
schema. I think this functionality is covered by this ticket: 
https://github.com/jOOQ/jOOQ/issues/1097. Given that, I think you would need to 
query the information schema of your database to list out every table that has 
a column called XML_ID.

Secondly, you could use this list to create dynamic query objects, i.e. those 
not backed by generated artifacts. Here is an example we wrote recently:

https://github.com/lshift/diffa/blob/v2/sql-driver/src/main/java/net/lshift/diffa/sql/DynamicTable.java

So that is actually quite simple, but you would need to know how to use it. If 
you then look in the sliceAssignedEntities() call of this class:

https://github.com/lshift/diffa/blob/v2/sql-driver/src/main/java/net/lshift/diffa/sql/DateBasedAggregationScanner.java

You can see how you can effectively feed in table definitions at run time and 
start using the normal JOOQ building blocks. You can use JOOQ to 
programmatically build your queries without having to use code generation.

The returned record types will be quite generic, because you don't have code 
generation. However, I think that this an exercise in factoring out your usage 
of the JOOQ runtime API, which, although differs from the normal generated code 
access patterns, is still quite a succinct and maintainable way of generating 
queries to solve your business requirement.

HTH,

Ben 


On Thursday, 24 January 2013 at 08:42, digulla wrote:

> On Tuesday, January 15, 2013 2:41:25 PM UTC+1, digulla wrote:
> 
> > I'm building a query along the lines of
> > 
> >   select PK, XML_ID from every table that has a column XML_ID where XML_ID 
> > like 'foo%'
> > 
> > (I build N selects and then join them using UNION ALL). The result of the 
> > query is Record which means consumers won't be type safe.
> > 
> > Instead, I'd like to return a record type but implementing Record is a lot 
> > of work and UpdatableRecordImpl<> needs one table (I have 188 tables) and 
> > AbstractRecord is package private.
> > 
> > Is that possible with jOOQ?

Reply via email to