James,

Hmmm, I thought about composition, but
functions require entities as parameters:
BIFMAMAINTERFACE.blablabla(POJO1, POJO2)
so with composition it would be:
BIFMAMAINTERFACE.blablabla(JSFBEAN.getWrapped1(),
JSFBEAN.getWrapped2())

Thank you for answer


2008/5/30 James Clinton <[EMAIL PROTECTED]>:
> Why don't you wrap or decorate the entity(pojo) where required?
> Personally in this situation I would favor composition over inheritance.
>
> -----Original Message-----
> From: Anton Gavazuk [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 30, 2008 9:10 AM
> To: MyFaces Discussion
> Subject: duplication POJO and JSF beans
>
> Hi all,
>
> I'm using JPA as persistence layer, and one of my modules contains
> more then 50 entities.
> Almost all of those entities (POJO) I must somehow show in UI.
> But in UI some POJOs should have extra fields - value for this fields
> is generated according to business logic, so the value is not a part
> of actual entity.
>
> Simple Example
>
> CorePojo
>   int a;
>   int b;
>   int generatedValue = businessFunction.(a,b);
>  ....
>
> I dont like approach when this "generated" value is being added to
> core POJO with @Transient mark - on other hand I dont' want to create
> in my JSF application copy of every original POJO with extra fields.
> So the only one way which I see now - create new POJO for UI which
> extends CorePojo and adds needed fields.
>
> So my question is:
> does someone come accross with same situation? How it can be resolved?
>
> DISCLAIMER: This e-mail is confidential and may also be legally privileged. 
> If you are not the intended recipient, use of the information contained in 
> this e-mail (including disclosure, copying or distribution) is prohibited and 
> may be unlawful. Please inform the sender and delete the message immediately 
> from your system.  This e-mail is attributed to the sender and may not 
> necessarily reflect the views of the Patsystems Group and no member of the 
> Patsystems Group accepts any liability for any action taken in reliance on 
> the contents of this e-mail (other than where it has a legal or regulatory 
> obligation to do so) or for the consequences of any computer viruses which 
> may have been transmitted by this e-mail. The Patsystems Group comprises 
> Patsystems plc and its subsidiary group of companies.
>
>

Reply via email to