Hibernate first level cache - does it Sync?

后端 未结 3 765
广开言路
广开言路 2021-01-05 19:53

I am aware of the fact that Session is first level

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-05 20:47

    You'll need to call Session.evict(Object) on s1 with u1 as an argument in order to get a fresh lookup. Alternatively, for this case, you could also call Session.clear() on s1 as well to get the same effect. You could also call Session.refresh(Object object) to just refresh the state of u1 as well.

    Note that transactions can take an undefined amount of time (usually not very long though) to be seen by other clients after they are committed. The update may not be visible immediately to other sessions using different connections.

提交回复
热议问题