Digest for jooq-user@googlegroups.com - 4 updates in 1 topic

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Digest for jooq-user@googlegroups.com - 4 updates in 1 topic

http://groups.google.com/group/jooq-user/topics mailing list
"Jens Teglhus Møller" <[hidden email]>: Oct 15 12:58AM -0700

Hi
 
As a follow up to some of my earlier questions regarding using
SpringPhysicalNamingStrategy when generating using JPADatabase I'm now
facing problems with record mapping my JPA classes.
 
When using the SpringPhysicalNamingStrategy a field named myField is mapped
to column my_field which the DefaultRecordMapper will not match correctly
(since I do not annotate using @Column(name="my_field")).
 
I tried to run the generator with jpaAnnotations=true so the Records get
the jpa annotations but it looks like the mapper only looks for the
annotations on the JPA classes.
 
Did anyone run into this and have a simple solution?
 
I thought about having locally maintained copies of
DefaultRecordMapper/DefaultRecordUnmapper and their providers but I think
the field name <-> column name conversion is pretty deeply buried in the
code.
 
I could also just skip using the JPA classes and just use the Record
classes, but I use lombok with @Accessor(chain=true) on my JPA classes and
really miss chained setters on the Record classes, could I add that
annotation myself with a costum Generator?
 
Just re-read my post and I can see it's a bit of a rambling but I still
hope someone can suggest a way forward :-).
 
Best regards Jens
Lukas Eder <[hidden email]>: Oct 15 11:41AM +0200

Hi Jens,
 
Thanks for your message. In jOOQ, the @Column annotation is currently
mandatory when you want to use DefaultRecordMapper to map to JPA annotated
entities:
https://github.com/jOOQ/jOOQ/issues/4586
 
Do note that jOOQ is not a JPA compliant ORM. We did choose to re-use
the @Column annotation because its semantics is already clear, but we do
not support a variety of JPA annotations.
 
I could also just skip using the JPA classes and just use the Record
> classes, but I use lombok with @Accessor(chain=true) on my JPA classes and
> really miss chained setters on the Record classes, could I add that
> annotation myself with a costum Generator?
 
 
You can turn on the <fluentSetters/> flag in the code generator to make
the setters fluent (returning "this"). You could try overriding
JavaGenerator.generateRecordSetter to add additional annotations before the
record setters... Not sure if that would solve your problem.
 
Thanks
Lukas
 
On Tue, Oct 15, 2019 at 9:58 AM Jens Teglhus Møller <[hidden email]>
wrote:
 
"Jens Teglhus Møller" <[hidden email]>: Oct 15 04:27AM -0700

Hi Lukas
 
Thanks a lot. I think fluentSetters will work well for me, then I will just
skip using JPA classes and just use the record classes.
 
The fluentSetters configuration option is missing from the manual, is seems
like it got lost somewhere between 3.8.0 and 3.9.0 release (I did look for
an option to generate fluent Records in the documentation but only for the
latest version ;-).
 
There is a link to the xsd where it is specified though
(http://www.jooq.org/xsd/jooq-codegen-3.12.0.xsd) but it is a bit hard to
find.
 
Best regards Jens
 
On Tuesday, October 15, 2019 at 11:41:47 AM UTC+2, Lukas Eder wrote:
Lukas Eder <[hidden email]>: Oct 15 04:58PM +0200

Thanks for the hint. We'll look into documenting <fluentSetters/> in the
manual as well:
https://github.com/jOOQ/jOOQ/issues/9376
 
On Tue, Oct 15, 2019 at 1:27 PM Jens Teglhus Møller <[hidden email]>
wrote:
 
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to [hidden email].