How to convert a Hibernate proxy to a real entity object

后端 未结 10 834
离开以前
离开以前 2020-11-22 16:49

During a Hibernate Session, I am loading some objects and some of them are loaded as proxies due to lazy loading. It\'s all OK and I don\'t want to turn lazy lo

10条回答
  •  醉酒成梦
    2020-11-22 17:29

    Starting from Hiebrnate 5.2.10 you can use Hibernate.proxy method to convert a proxy to your real entity:

    MyEntity myEntity = (MyEntity) Hibernate.unproxy( proxyMyEntity );
    

提交回复
热议问题