Hibernate Envers: Retrieving the right revisions of an entity with a collection property

前端 未结 3 619
醉话见心
醉话见心 2021-01-27 06:18

I have two audited entities, A and B. Entity A holds a collection of entity B (annotated as One-to-many relationship). When inserting a new instance of A into the database, all

3条回答
  •  盖世英雄少女心
    2021-01-27 06:24

    In Hibernate we could control the loading of children by specifying lazy. So, you need to add the below line to your class definition in hibernate configuration for it to load all the associations in both read/write cases.

    
    

    If you have marked CacheMode.REFRESH then it will write items to the second-level cache. Do not read from the second-level cache.

    If you don't have issues in loading the children at the time of parent you could turn of lazy which will return the updated information.

提交回复
热议问题