-->
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: Concurrence optimiste
PostPosted: Wed Apr 23, 2008 1:42 pm 
Newbie

Joined: Mon Apr 14, 2008 7:32 pm
Posts: 2
Bonjour,

Je rencontre un problème étrange lorsque j'implémente la concurrence optimiste avec un champ VERSION.

Je spécifie, au début de ma classe persistante:
Code:
@org.hibernate.annotations.Entity(optimisticLock = org.hibernate.annotations.OptimisticLockType.VERSION)


Et j'ai ajouté un champ VERSION dans ma table de BD et aussi dans ma classe persistante:
Code:
@Version
@Column(name = "VERSION", updatable = true, nullable = false)
public Integer getVersion() {
      return this.version;
}

public void setVersion(Integer pVersion) {
      this.version = pVersion;
}


Le problème est qu'Hibernate transforme les UPDATE en INSERT lorsque je gère la concurrence de cette façon. Pour une modification d'objet persistant, lorsque l'on appel saveOrUpdate(), la modification devient un nouvel enregistrement. Il en résulte une erreur d'ORACLE de contrainte d'intégrité (c'est normal, la clé unique se retrouvant 2 fois inséré).

Merci de me guider vers une piste. Nous utilisons les Annotations dans les classes persistantes directement.


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.