Hibernate MySQL -
i have 2 tables table1 , table2 in mysql database. when user1 performs operation, updates row1 in table1 , performs operation-x , updates row1 in table2. while code performing operation-x, other user, user2, updates row1 in table2. if happens operation-x performed user1 not update row1 in table2. want create write lock in both rows of table unless operation-x complete , update happens in table2, don't want user2 update particular row in table2. using hibernate template updating etc. in mysql database.
thanks in advance
the usual strategy use optimistic locking, described in the documentation. consists in adding column , corresponding field entity, annotated @version:
@version private long version;
Comments
Post a Comment