开发者

LockMode.READ in Hibernate

I'm new to Hibernate and trying to understand more about the LockModes.

I found below text in book "Java Persistence with Hibernate":

LockMode.READ—Bypass all caches, and perform a version check to verify that the object in memory is the same version that currently exists in the database.

Does that mean, calling session.lock(myObject, LockMode.READ), will refresh myObject state from Database? From "version check" I understand that Hibernate will check the version of myObject with Database, and if there is a difference it will synchronize instance of myObject with that of data开发者_运维技巧base.

I should also mention that after synchronizing the myObject instance with database, Hibernate will attach the myObject instance with persistence context (or session).

Isn't that correct?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜