Hibernate: Refresh, Evict, Replicate and Flush

后端 未结 3 1927
终归单人心
终归单人心 2020-11-30 21:43

I wish I knew what exactly does each item in this list, how it works, what the consequences and when is the correct time to use.

  1. Refresh
  2. Evict
3条回答
  •  心在旅途
    2020-11-30 22:05

    • session.flush() Flushing the session forces Hibernate to synchronize the in-memory state of the Session with the database.
    • session.evict() Detach the object from session cache. After detaching the object from the session, any change to object will not be persisted.
    • session.refresh() Reload all the data.
    • session.replicate() Data is replicated in different Datastore in different modes.

提交回复
热议问题