users@glassfish.java.net

Re: _at_many-to-one with composite key for multiple columns challenge..

From: <glassfish_at_javadesktop.org>
Date: Mon, 23 Apr 2007 13:19:14 PDT

> mf125085: I didn't quite understand what you meant by
> "Meaning that updating one relationship could
> possibly
> modify another relationship mapped to the same
> column".

For example:

EntityManager em = ....;
TestEntity t = new TestEntity(1);
SetupTypeEntity s1 = new SetupTypeEntity(1, 1);
SetupTypeEntity s2 = new SetupTypeEntity(2, 2);

em.getTransaction().begin();
t.setSpecSetupType1(s1);
t.setSpecSetupType2(s2);
em.persist(t);
em.getTransaction().commit();

The numbers in the constructors stand for different primary keys, this way setting conflicting values for the column TESTENTITY.VPD_ID. How would you ensure, the vpdId's for both relationships are always the same?
[Message sent by forum member 'mf125085' (mf125085)]

http://forums.java.net/jive/thread.jspa?messageID=213825