users@glassfish.java.net

Re: JPA question

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 02 Jan 2008 14:43:00 -0800

By default Toplink caches your objects as-is and doesn't update the references.

Regards,
-marina

Pawel R. wrote:
> So what is the default behavior? Should TopLink update the reference in CreditCard object? Or we have to do cust.setCreditCard(card) with card.setCustomer(cust).
>
>
> -----Original Message-----
> From: Edson Carlos Ericksson Richter [mailto:edson.richter_at_mgrinformatica.com.br]
> Sent: Monday, December 24, 2007 3:59 PM
> To: users_at_glassfish.dev.java.net
> Subject: Re: JPA question
>
> Hum, may be, when you fetch the object form the database, you can choose
> to not use cache (unfortunatelly, the reloading policies are bound to
> Library constants.
>
> So, if you are using Hibernate, check Hibernate docs. If you are using
> TopLink, check TopLink docs about how to)...
>
> A forced cache reload should solve the problem...
>
> Regards,
>
> Edson Richter
>
>
> Pawel R. escreveu:
>
>>I've just read (Enterprise JavaBeans 3.0 - Burke, Monson-Hafel) that you should be careful when there is a mappedBy and you should (when the Customer is the owner of the relation):
>>
>>Example from the book:
>>
>>Customer cust = new Customer();
>>CreditCard card = new CreditCard();
>>cust.setCreditCard(card);
>>card.setCustomer(cust);
>>
>>em.persist(cust);
>>
>>I thought that mappedBy does it and after fetching we have well prepared, bidirectional relation :/. Strange :/.
>>
>>-----Original Message-----
>>From: glassfish_at_javadesktop.org [mailto:glassfish_at_javadesktop.org]
>>Sent: Sunday, December 23, 2007 10:30 PM
>>To: users_at_glassfish.dev.java.net
>>Subject: Re: JPA question
>>
>>Hey buddy,
>>
>>No it's not a good solution, try a book related to JPA, to find better solution for relations and cascades. I couldn't find out the exact relationship between document and template but I feel there is something wrong in your design, that's why you retrieve null.
>>You can try Apress Pro EJB 3 Java Persistence API book. I've found it so great.
>>
>>Regards,
>>
>>James
>>[Message sent by forum member 'nasim_kabi' (nasim_kabi)]
>>
>>http://forums.java.net/jive/thread.jspa?messageID=251299
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>