[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: Getting generated ID by sequence

rjstanford do-not-reply at jboss.com
Thu Sep 13 14:44:31 EDT 2007

I'm having a similar problem - using MySQL as the backend (not that I think it matters) and just the default @GeneratedValue option.

I've seen references in other sites that imply that if you use a generated value, the Id will be updated as soon as you call persist().  In our case, before calling persist() it is null (correct), but after calling persist() its always zero.

I've tried doing a refresh() afterwards, but that doesn't seem to make a difference either.

To avoid the questions, we're trying to get the Id of a newly created (and inserted) object so that we can push that Id into Session state.  Seems simple enough, right?


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084153#4084153

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084153

More information about the jboss-user mailing list