Support for updatable View in Firebird 3.0 ( using JOOQ v.3.9.5)

17 views
Skip to first unread message

Buddhika Ekanayake

unread,
Oct 15, 2017, 2:31:26 PM10/15/17
to jOOQ User Group
Hello to all,

I have an View that performs inserts & updates via triggers(Firebird 3). When I generate pojos, JOOQ doesn't recognize the view as an "Updatable" record though extended using the TableRecordImpl. As I'm pretty much settle with record level "STORE" and "REFRESH" for insertions and updates, this makes me unable to perform both these operations. :(  

So I manually changed this record to updatable and force a primary key to handle the store operation. It's works well, triggers do their job too & nothing much to complain. But real problem raises later part, when I'm trying to do the "refresh". :)  Yes, its unable to catch the generated key value from underlying table for an insert attempt. 

I know its logical, but I'd like to know, is there any way to perform this operation within record level approach. (I didn't uses much the insert statements with returning though)  

Many Thanks ! 

Buddhika E. 





 

 

 

Lukas Eder

unread,
Oct 15, 2017, 5:45:33 PM10/15/17
to jooq...@googlegroups.com
Hi Buddhika,

I think the notion of synthetic primary keys that you can configure in the code generator might be the solution to your problem:

Hope this helps,
Lukas

--
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 jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Buddhika Ekanayake

unread,
Oct 17, 2017, 2:41:00 AM10/17/17
to jOOQ User Group
Hi Lukas, Thanks very much for your response. 

Could you please provide more details how to do this with a Firebird view ?  lets say I have a view called TEST and ID_TEST will be the syntetic primary key, How should I pass this to code gen. via Maven ?  

<configuration>
  <generator>
    <database>
      <syntheticPrimaryKeys>???????</syntheticPrimaryKeys>
    </database>
  </generator>
</configuration>

BR, 
Buddhika E. 


To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.

Lukas Eder

unread,
Oct 17, 2017, 3:50:19 AM10/17/17
to jooq...@googlegroups.com
Hi Buddhika,

In short, these configurations always do the same thing. They're regular expressions matching things, in this case, you have to match TEST\.ID_TEST.

If you're using another database that supports schemas and/or catalogs, you'd have to prepend those as well, e.g. by matching all schemata: (.*?\.)?TEST\.ID_TEST

And if you want to stay on the safe side, you can make your regex case insensitive: (?i:TEST\.ID_TEST)

And yes, this is the ordinary code generator <configuration> element, which you may use in standalone code generator configurations, or with maven, etc.

Hope this helps,
Lukas

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages