Hello,
I have a design question regarding writing converters.
I have a detail screen of entity, say for example a customer, which has
a drop-down of another entity, for example an address.
A customer has an address, and both are model objects mapped in Hibernate.
In the detail screen of customer, I have a dropdown of addresses (why,
please ignore that, it is a simplified version of actual problem), and I
have written a SelectItems listing method which populates that address.
This field also has a converter, that takes the submitted address_id,
and builds an address object.
My question is:
Should it be the job of the converter to actually lookup an address
object from hibernate session and hand it over to customer (that way at
the time of saving customer, the customer does not have to worry about
proper linking to proper hibernate address object).
Or, should the converter just build a plain java address model object,
and customer should rehydrate it from hibernate session before saving
itself?
What is a better approach? Or is there any other practice that should be
followed?
Thanks
MRather