Hi, I am using generator class, assigned in my mapping file . how can i retrieve the generated id after persisting the object to database . Do i need to take it from database again ? Thanks & Regards Anuja K
It will be available just after Session.save(object) is called.
All desirable things in life are either illegal, banned, expensive or married to someone else !!!
posted 10 years ago
Session.save() will return the ID it assigned (just in case you do not have accessor methods in your persistent entity). but as the others mentioned: it's already assigned after the call to Session.save().