在使用hibernate进行查询的时候报如下错误
Unable to find Object with id 2
javax.persistence.EntityNotFoundException: Unable to find My028888Groupinfo with id 2 at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$JpaEntityNotFoundDelegate.handleEntityNotFound(EntityManagerFactoryBuilderImpl.java:144) ~[hibernate-entitymanager-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.proxy.AbstractLazyInitializer.checkTargetState(AbstractLazyInitializer.java:242) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:159) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:266) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final] at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:73) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
经过查询My028888Groupinfo表里,只有id为2这个数据的
后来发现原来是该表关联的另一个实体,是急加载,但是该字段为空,所以讲该字段填充上即可
爆款云服务器s6 2核4G 低至0.46/天,具体规则查看活动详情