I'm having a problem with Immutable POJOs. Well, not Immutable but with a
constructor annotated with @ConstuctorProperties. As I'm typing this I'm
wonder if getters can overwrite constructor names. But here's the issue I'm
having:
I have a query returning one Numeric identity field and three Timestamp
fields. I have a POJO with a constructor like this:
@ConstructorProperties({"id", "lastCalled", "lastAnswered",
"lastConnected"})
public FriendCallInfo(final Long id, final Timestamp lastCalled, final
Timestamp lastAnswered, final Timestamp lastConnected) {...}
But this constructor only ever gets called with "id". What's interesting is
that I only have one getter on this class and it is for #getId. The others
don't have proper getters. That makes me wonder if the JOOQ implementation
is trying to be clever, so instead of just using my ConstructorProperties
it is also looking for fields and getters. Since it finds one for #getId it
ignores the other properties in my Constructor.
Yes it looks like that is the case. If I rename #getId to something like
#getThisId then even the ID doesn't get sent to the constructor. It appears
as if the contract requires not only a properly annotated constructor but
also either a field or member with the same name as the constructor
property.
Would you consider this a bug and if so should I create an issue for it? It
seems like I should be able to create a java object that has a well defined
constructor that may take a different form than the getters and setters of
the bean. I currently do it this way in JPA. But maybe that breaks some
contract.
Thanks!
--
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.