users@glassfish.java.net

How to get sequence id?

From: <glassfish_at_javadesktop.org>
Date: Thu, 16 Aug 2007 20:34:24 PDT

Hi,

I have the following entity definitions:

@SequenceGenerator(name = "EID_SEQUENCE", sequenceName = "EID_SEQ",
        allocationSize=1)
public class IdTransaction extends Activity {
...

and

@SequenceGenerator(name = "EID_SEQUENCE", sequenceName = "EID_SEQ",
        allocationSize=1)
public abstract class Activity implements Serializable {
 
   @Column(name="EID")
   @Id
   @GeneratedValue(strategy = GenerationType.SEQUENCE,
           generator = "EID_SEQUENCE")
   protected Long eid;

   public Long getEid() {
       return eid;
   }

...
}

In my Java client, here is how I am persisting the IdtTransaction object. I can view the entry in the database table including the "eid" column.


            IdtTransaction transaction = new IdtTransaction();
            transaction.setActivityID("test");
            sessionEJB.persistEntity(transaction);
...
How do I read the sequence id "eid" that is just generated?

Thanks,

Mustafa
[Message sent by forum member 'mcayci' (mcayci)]

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