Thanks Shawn, for the quick responses.

-MRather


Garner, Shawn wrote:
Not in the converter.

-----Original Message-----
From: M Rather [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 17, 2007 9:57 AM
To: MyFaces Discussion
Subject: Re: design question regarding converters - who is responsible
for building hibernate converted object

Well, access to persistence layer would go through service layer in both

cases..
The question is, which object should concern itself to building an 
object which is persistence aware.

I was also leaning towards 'a converter should only do object to object 
conversions. ' But I was looking towards some opinion of where the 
lookup of address object from persistence before assigning to customer 
should reside.. In the converter or the managed bean for customer.

MRather

Garner, Shawn wrote:
  
It is my opinion that the UI should not concern itself with the
persistence layer.
The UI should delegate to the service layer which should delegate to
persistence.
IMO a converter should only do object to object conversions.
What you are talking about I've seen done in the getter method of the
bean that returns the list of select items or in the constructor.
I've also seen it done in an action method of a handler backing bean.
I've heard that shale has a hook to a view to initialize things prior
    
to
  
rendering too.

Shawn
 

-----Original Message-----
From: M Rather [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 17, 2007 9:33 AM
To: MyFaces Discussion
Subject: design question regarding converters - who is responsible for
building hibernate converted object

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


-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable
    
law.
  
If you are not the intended recipient, any dissemination, distribution
    
or
  
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to [EMAIL PROTECTED] and delete or destroy all copies
    
of
  
the original message and attachments thereto. Email sent to or from
    
the
  
Principal Financial Group or any of its member companies may be
    
retained
  
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic
    
signature
  
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this
    
message.
  
While this communication may be used to promote or market a
    
transaction
  
or an idea that is discussed in the publication, it is intended to
    
provide
  
general information about the subject matter covered and is provided
    
with
  
the understanding that The Principal is not rendering legal,
    
accounting,
  
or tax advice. It is not a marketed opinion and may not be used to
    
avoid
  
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to
    
legal,
  
tax, or accounting obligations and requirements.

  
    


-----Message Disclaimer-----

This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to [EMAIL PROTECTED] and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.

Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.

While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.

  

Reply via email to