-->
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: OptimisticLockType.ALL Versioning
PostPosted: Sun Jul 03, 2011 4:38 am 
Newbie

Joined: Sun Jul 03, 2011 4:23 am
Posts: 1
Hi guys, this is my first post.
I have trouble getting Hibernate Automatic Versioning.
I use Annotation but seems that OptimisticLockType.ALL is ignored.

This is my entity class:
Code:
@Entity
@Table(name = "utente")
@org.hibernate.annotations.Entity(optimisticLock = OptimisticLockType.ALL, selectBeforeUpdate=true, dynamicUpdate = true)
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Utente.findAll", query = "SELECT u FROM Utente u"),
    @NamedQuery(name = "Utente.findByUsername", query = "SELECT u FROM Utente u WHERE u.username = :username"),
    @NamedQuery(name = "Utente.findByNome", query = "SELECT u FROM Utente u WHERE u.nome = :nome"),
    @NamedQuery(name = "Utente.findByOnline", query = "SELECT u FROM Utente u WHERE u.online = :online"),
    @NamedQuery(name = "Utente.findByEmail", query = "SELECT u FROM Utente u WHERE u.email = :email")})
public class Utente implements Serializable {


this is the code where i do the query:
Code:
@Override
public void merge(T istance)
{
    sessionFactory.getCurrentSession().merge(istance);
}



If i create a version field and set @Version on that field, and also use OptimisticLockType.ALL the versioning work fine, like if I have set OptimisticLockType.VERSION.
Please help me I'm stuck.
Thank you in advance and sorry for my english.


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.