Al 09/06/2010 14:27, En/na Thiago H. de Paula Figueiredo ha escrit:
On Wed, 09 Jun 2010 09:16:55 -0300, Everton Agner <everton_ag...@yahoo.com.br> wrote:

I'm not a Hibernate advanced user, but you're using a XML and Entity class annotations to configure your Entity?

I haven't noticed that. Ewerton is right: no need to use XML mappings when you use annotations.

Anyways... If you want your app to automatically increment your ID before saving it, you shouldn't use the:

In this case, it isn't the app the increments the ID, the database does.

<generator class="assigned" />

Or @GeneratedValue.


thanks for the replies :)

I generate the classes using eclipse hibernate plugin, which creates the xml and the classes with the annotations (redundant I know, but doesn't matter atm).

The database (Oracle 10g) has an index so it knows which Id to assign next to the new record, but instead of this the new object gets Id = 0 (the next one Id=1 and so forth). It should be the db who assigns the right Id to the new record, but I don't know why this isn't happening...

I've tried with

@GeneratedValue(strategy = GenerationType.IDENTITY)

and

@GeneratedValue(strategy = GenerationType.AUTO)

with the same result (id=0)



hm...

Genis


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to