Hi Collin,
There's a (currently undocumented) feature that supports to-one mappings in
the DefaultRecordMapper, if your columns are labelled "home.street.number"
or "home.city". This works for target types like:
class Client {
Address home;
Address work;
}
class Address {
Street street;
String city;
}
class Street {
String number;
}
It is currently undocumented, because this is still a moving target, and we
haven't covered all the edge cases that might appear. Your feedback as a
beta-tester of this functionality is thus very welcome :-) (it would be
great if we could improve this functionality!)
Note that this currently only works when mapping from Record -> POJO, not
when "unmapping" from POJO -> Record.
I hope this helps
Lukas
2016-01-25 16:47 GMT+01:00 <[email protected]>:
> What is the recommended way to handle a use case like this:
> A Client object which has 2 fields of type Address: homeAddress,
> workAddress
> A clients table which has expanded columns for this. e.g.
> home_address_street_number, home_address_city, etc... (so like 5 columns
> for each address)
>
> Currently DSL.newRecord doesn't pick it up at all, I am assuming because
> the column name can't find a match because of the custom Address type. How
> to best solve this? I was looking at RecordProviderMapper but I'm not sure
> if this will work for a case where you have 5 columns mapping to one object
> (which contains 5 fields). Also the fact that there are multiple of that
> type (home and work).
>
> Thoughts?
>
> --
> 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.
>
--
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.