开发者

Versioning in Hibernate's optimistic locking

I'm new to Hibernate, and i'm trying to understand @Version annotation. In all examples I've seen it looks like 开发者_开发技巧I should provide special column in each table of my database. Am I right? I understand what optimistic lock means, but can I make only hibernate responsible for versioning and do not change database?


You should add a column to a table , if you want to use optimistic locking.. Well, it is not necessary to add a version column to all tables for optimistic locking, if Child entity is accessed and modified by means of Parent entity , then you dont have to put a version column to the table of Child entity..

Optimistic locking is powerful feature of O-R engines, it did not cause any performance loss or deadlock like database pessimistic locking, therefore it should be preferred ..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜