users@glassfish.java.net

RE: JPA question

From: Pawel R. <odwrotnie_at_gmail.com>
Date: Mon, 24 Dec 2007 12:40:06 +0100

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