Peculiar Behavior with AutoGenerated Code

25 views
Skip to first unread message

Samir Faci

unread,
May 12, 2016, 7:34:33 PM5/12/16
to jooq...@googlegroups.com
I'm not sure if this is a bug or was brought up before (I hope not).

But if I have a table named

DATE_FORMAT

Which also includes a column named DATE_FORMAT 

Then the autogen code seems to add an underscore to the column name.

For example:
        List<String> supportedDateFormats = dslContext.
                selectDistinct(DATE_FORMAT.DATE_FORMAT_)
                .from(DATE_FORMAT)
                .orderBy(DATE_FORMAT.DATE_FORMAT_)
                .fetchInto(String.class);

is this intentional? Or is there something I can do on my end configuration wise to avoid this pattern


--
Thank you
Samir Faci

Lukas Eder

unread,
May 13, 2016, 3:37:39 AM5/13/16
to jooq...@googlegroups.com
Hi Samir,

This is intentional. There is already a table literal DATE_FORMAT, which would collide with the column literal DATE_FORMAT.

You can use jOOQ's generator strategies to rename either the table literal, or the column literal:


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

Lukas Eder

unread,
May 13, 2016, 9:20:59 AM5/13/16
to jOOQ User Group
For the record, this was introduced in jOOQ 2.1.0:

There is now a very similar regression in jOOQ 3.8.0 where table names may collide with schema names:
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.

Samir Faci

unread,
May 15, 2016, 1:01:43 AM5/15/16
to jooq...@googlegroups.com
Thanks for the info Lukas.  It seems like they're different entities and shouldn't collide but I'll adjust the generator to behave accordingly. 



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

For more options, visit https://groups.google.com/d/optout.

--
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+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Lukas Eder

unread,
May 15, 2016, 3:26:03 AM5/15/16
to jooq...@googlegroups.com
Yes, they shouldn't collide. I thought we already had a pending feature request to allow for deactivating the table literal inside of the table class, but I couldn't find it. So here it is:

The reason why the table literals are declared in the table class is historic. Also, for very large schemas, the Tables.java class no longer compiles because the static initialiser gets bigger than 64kb in bytecode size. But being able to turn on/off the generation of these identifiers will certainly help.

Cheers,
Lukas
Reply all
Reply to author
Forward
0 new messages