Hi Jeff,
glassfish@javadesktop.org wrote:
Hi,
JPA recommends to always maintain relationships on
both sides. In your
case, please also set the relationship on the Payee
side.
Isn't that what I'm doing by doing the following ?
public abstract class Payee implements Serializable {
@ManyToOne
@JoinColumn(name = "CLAIMANT_ID")
private Claimant claimant;
This just *declares* the ("owning") side of the bi-directional
relationship. The "non-owning" side is field Claimant.payees.
In your application, please set relationships between Claimant and
Payee the following way:
EntityManager em = ...;
....
em.getTransaction().begin();
Claimant c = new Claimant();
Payee p = new Payee();
c.getPayees().add(p);
p.setClaimant(c); // <--- this is the step I mentioned before
em.persist(c);
em.getTransaction().commit();
-- markus.
[Message sent by forum member 'jeffmutonho' (jeffmutonho)]
http://forums.java.net/jive/thread.jspa?messageID=212597
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net