users@glassfish.java.net

Re: JPA – Toplink Essentials - Retrieving PK populated by an Oracle Trigger

From: <glassfish_at_javadesktop.org>
Date: Mon, 29 Oct 2007 13:33:24 PST

You should be able to do what you need now.
In SessionCustomizer call the following method:
((OraclePlatform)session.getPlatform()).setSupportsIdentity(true);

Annotations:
@Id
@Column(name = "CANDIDATE_ID", nullable = false)
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int candidateId;
will cause
select SEQ_GEN_IDENTITY.currval from dual

You can also specify a sequence you'd like to use, too:
@GeneratedValue(strategy=GenerationType.IDENTITY, generator="MY_SEQ")
(don't define the generator) will cause
select MY_SEQ.currval from dual
[Message sent by forum member 'ailitche' (ailitche)]

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