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.  [ 1 post ] 
Author Message
 Post subject: version check without anything else
PostPosted: Sun Jun 17, 2007 6:20 am 
Newbie

Joined: Sat Jun 09, 2007 11:45 am
Posts: 6
Hello!

How can one do a versionCheck without anything else, without using an entities getVersion() method? Is there any mean given by hibernate session?

I just want to check if my Object has the same version as the object
in the database.

Ok, if the object is in the session already, I can do it with the session´s get method.

get(Class clazz, Serializable id, LockMode lockMode)

But my problem is, I am not sure that this is the case.

The other option in my case would be to use session´s merge-method

merge(Object object)

that also does a version check. If it detects different versions in database and in object it throws an StaleObjectStateException, otherwise it will update the entry in the database. The problem with this solution is, that in my special case I want to do some more versionschecks, before deciding wether the database-entry should be updated or not.

I´m curious about hearing some suggestions and thank anyone making his brain working for me in advance.

Best regards,

Jörg


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

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.