users@glassfish.java.net

Re: diferent behaviour between GeneratedType.AUTO and GeneratedType.SEQUENC

From: <glassfish_at_javadesktop.org>
Date: Wed, 20 Feb 2008 06:50:46 PST

What version of TopLink Essentials are you using. An older version only supported Identity Sequences on Postgres and would automatically switch from SEQUENCE to IDENTITY. This has been fixed ( https://glassfish.dev.java.net/issues/show_bug.cgi?id=283 )
With SEQUENCE what you are attempting should work on TopLink Essentials

In your example you could easily leverage 'flush()' by altering your order of operations and setting Sequencing on B.

[code]
A a = new A();
B b = new B();

public void test() {
  em.persist(b);
  em.flush();
  a.setB(b); // one-to-one required association
  a.setId(b.getId());
  em.persist(a);
}
[/code]
[Message sent by forum member 'gyorke' (gyorke)]

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