I have an entity bean on these lines..

@Entity
User {
  @Version int version;
  
   @Id String id;

...
...
}

Then I have a SLSB with this method:

updateUser (User u) {
    @PersistenceContext
    EntityManager em;


   List dbUsers =  em.createQuery("select from User u where u.name = 
'user1').getResultList();
    User dbUser = dbUsers.get(0);

    dbUser.setName("user2");
    
   
}

i would have expected the version count of the user to be incremented. this 
does not happen.

Then i tried with the following
em.lock(dbUser, LockModeType.READ);
and also em.lock(dbUser,LockModeType.WRITE);
before the setter method. 

still the version does not get updated.

What am i doing wrong here..


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3962070#3962070

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3962070
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to