-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Reading ID values after session.save(object)
PostPosted: Mon Jan 14, 2008 11:03 am 
Newbie

Joined: Mon Jan 14, 2008 10:50 am
Posts: 3
Hi, i think that is a config problem, so... i put here some, the problem. If necessary, i will update with more informations.

The problem is simple:
.
.
.
User user = new User();
user.setName("Name");
session.save (user);
System.out.println("Generated ID: " + user.getId);
.
.
.
session.commit, bla bla bla...
.
.
The user.getId does not return generated value (Oracle sequences) that i have mapped.

User is always saved into database normally, i can see the record using a SQL*Plus, but.... i want to find the generated ID for user to store in a LOG table.

Anybody have a solution that allow to give a generated value for PK, after COMMIT ????


Top
 Profile  
 
 Post subject: Re: Reading ID values after session.save(object)
PostPosted: Mon Jan 14, 2008 12:43 pm 
Newbie

Joined: Mon Jan 14, 2008 10:50 am
Posts: 3
edson.goncalez wrote:
...
System.out.println("Generated ID: " + user.getId);


in the output, value returned is -1.

:(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.