users@glassfish.java.net

How to generate primary key in an entity class generated from existing db?

From: <glassfish_at_javadesktop.org>
Date: Thu, 07 Aug 2008 01:55:06 PDT

Hi,

I've generated my entity classes from an existing database. The generated classes have a field annotated with @ID and the id is a parameter to the constructor.

I would like the ID to be generated when a new object is created.

So how should this be done?

I could manually at the @Generated to the id field but than this change would be lost if I re-generate the entity class.

thanks in advance

regards
robert
[Message sent by forum member 'wierob' (wierob)]

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