Hi,

I have a database which use global unique row ID instead of (autoincrement) ID 
per table.
I'm trying to encapsulate this aspect so I don't need to manually use an ID 
generator every time. 
I implemented a VisitorListener to "inject" ID on insert query if not specified 
and works fine unless I trying to return a record.

I tried to use returning() but it has a different behavior than expected (but 
in this case my expectation is probably wrong). 

Seems that returning() works only for database auto-generated stuff, and is 
hard to alter this bahavior. 

My attempt was the following:
I used VisitorListener to inject id in the query, the implementation collect 
the generated ID and implement also the ExecuteListener interface which allow 
to manipulate the statement before the execution. So I create a prepared 
statement wrapper which is ids aware and return they when getGeneratedKeys() is 
invoked. I did it, but then jooq ask for table.getIdentity() and I stopped. 

My concerns are:
- am I right simulating auto-generated key behavior? 
- how can I obtain a record automatically without executing an explicit select? 
Moreover in this case I don't even know the ID to use for the select because is 
injected by the visitor 

At this very moment, I discarded this idea, set id at application level and 
manually execute a select to obtain a record. 

Any thoughts? 

Cheers
 

-- 
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/d/optout.

Reply via email to