-->
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: Optimistic lock - read increase version number
PostPosted: Fri Oct 01, 2010 7:54 am 
Newbie

Joined: Fri Oct 01, 2010 7:39 am
Posts: 2
Hi,
I use optimistic lock to prevent concurrent update,
configured like this:
<class name="Cls" table="tbl" optimistic-lock="version" >
...
<version name="version" column="version" />
<property name="created" column="createdTS" type="timestamp" generated="always" />
...

But even if I only read the record the version number increased
I read it like this for example:

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
Criteria criteria =session.createCriteria(Cls.class);
criteria.list();
session.getTransaction().commit();

What is wrong with my config or code?
Why the version numbere incresed every time.
Thank you.


Top
 Profile  
 
 Post subject: Re: Optimistic lock - read increase version number
PostPosted: Fri Oct 01, 2010 9:43 am 
Newbie

Joined: Fri Oct 01, 2010 7:39 am
Posts: 2
One of the field used a custom UserType, which caused the problem


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.