Force eager loading of otherwise lazy loaded prope

2019-03-22 17:34发布

I've got a Hibernate object which's properties are all loaded lazy. Most of these properties are other Hibernate objects or PersistentSets.

Now I want to force Hibernate to eager load these properties for just one time.

Of course I could "touch" each of these properties with object.getSite().size() but maybe there's another way to achieve my goal.

7条回答
戒情不戒烟
2楼-- · 2019-03-22 18:00

Dozer works well for this type of thing - you can ask Dozer to map the object to another instance of the same class, and Dozer will visit all objects reachable from the current object.

See this answer to a similar question and my answer to another related question for more details.

查看更多
登录 后发表回答