jooq pojo generation on postgres db getters/setters wrong naming case

38 views
Skip to first unread message

Denis Miorandi

unread,
Jun 15, 2016, 6:46:05 AM6/15/16
to jOOQ User Group
I'm using _ naming notation in postgress.
When I've got and _ on 2nd place I've got an unexpected name.

DB FIELD NAME: 
n_civ_residenza

JOOQ JAVA METHODS (seems wrong to me the uppercased 'N')
nCivResidenza
getNCivResidenza
setNCivResidenza

JAVA ECLIPSE GENERATED METHODS (seems right to me)
nCivResidenza
getnCivResidenza
setnCivResidenza

any suggestions? Is it by design or it's a bug?


Tks
Denis

Lukas Eder

unread,
Jun 17, 2016, 3:46:01 AM6/17/16
to jooq...@googlegroups.com
Hi Denis,

That's weird that Eclipse generates methods like this. From how I understand the ancient JavaBeans specs / naming conventions, the property is camelCased as a property name, but PascalCased as a name "suffix" for the getter and setter. It might look a bit weird here with the n_ prefix, but imagine a class Person:

class Person {
    String firstName;
    String lastName;

    public void setFirstName(String firstName);
    public void setLastName(String lastName);
    // ...
}

I think that's correct, no?

In any case, if you don't agree with jOOQ's default naming patterns, you can always override them via generator strategies:


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.

Denis Miorandi

unread,
Jun 17, 2016, 6:36:25 AM6/17/16
to jOOQ User Group
I don't know the exact convention to naming. What I think is that eclipse way is the standard one, cause other engines use exactly that one and fail in same cases on jooq pojo cause they are not compatible (se the example on initial post).
In example using ZKoss gui library (using EL expressions) I declare just field on name view side and engine call internally getters and setters to bind value expecting the Eclipse syntax. 

Here explain naming conventions on java bean and answer to your argue


About patxhing this I'm looking for custom generator like this, but I din't find a standard getter setter generator at now.

@Override
public String getJavaSetterName(Definition definition, Mode mode) {
return "set" xxxxx
}

/**
* Just like setters...
*/
@Override
public String getJavaGetterName(Definition definition, Mode mode) {
return "get" xxxxxx
}

Denis Miorandi

unread,
Jun 21, 2016, 2:27:02 AM6/21/16
to jOOQ User Group
I've opened an issue to track this

Lukas Eder

unread,
Jun 21, 2016, 7:20:45 AM6/21/16
to jooq...@googlegroups.com
Thanks for your continued feedback. Very interesting, I wasn't aware of these caveats... Will continue discussing and providing feedback on the issue you've opened.

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