-->
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.  [ 3 posts ] 
Author Message
 Post subject: saveOrUpdate problem with id
PostPosted: Fri Jun 30, 2006 9:28 am 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
Hi all
I do a saveOrUpdate on my instance.
After I've done it I try to get the id of the same instance passed to saveOrUpdate method.
I get an id that is the real id minus one.

I have in the data base an entry with id greater of one than what i get on my log.
any help?
Please help i'm going crazy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 30, 2006 4:51 pm 
Newbie

Joined: Thu Jun 15, 2006 2:15 pm
Posts: 15
Not much to go on here but:
make sure your map file key matches your database. If your database generates the key set map file key to native


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 03, 2006 10:04 am 
Expert
Expert

Joined: Tue Dec 28, 2004 7:02 am
Posts: 573
Location: Toulouse, France
Why are you calling saveOrUpdate() ? In the reference doc, you can read this :
http://www.hibernate.org/hib_docs/v3/re ... veorupdate
Quote:
The usage and semantics of saveOrUpdate() seems to be confusing for new users. Firstly, so long as you are not trying to use instances from one session in another new session, you should not need to use update(), saveOrUpdate(), or merge(). Some whole applications will never use either of these methods.


Could you precise your question ? What's in your SQL logs ? Which requests are sent ?

_________________
Baptiste
PS : please don't forget to give credits below if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.