org.hibernate.LazyInitializationException: could not initialize proxy [com.hkt.cch8.drgo.openemr.entity.Facility#3]- no Session
at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:169)~[hibernate-core-5.3.12.Final.jar:5.3.12.Final]
at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:309)~[hibernate-core-5.3.12.Final.jar:5.3.12.Final]
at org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor.intercept(ByteBuddyInterceptor.java:45)~[hibernate-core-5.3.12.Final.jar:5.3.12.Final]
at org.hibernate.proxy.ProxyConfiguration$InterceptorDispatcher.intercept(ProxyConfiguration.java:95)~[hibernate-core-5.3.12.Final.jar:5.3.12.Final]
at com.hkt.cch8.drgo.openemr.entity.Facility$HibernateProxy$LPfy4ulT.getName(Unknown Source)~[classes/:?]
at com.hkt.cch8.drgo.AppointmentTest.searchAppointmentDoctor(AppointmentTest.java:132)[test-classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)~[?:1.8.0_101]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)~[?:1.8.0_101]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)~[?:1.8.0_101]
at java.lang.reflect.Method.invoke(Unknown Source)~[?:1.8.0_101]
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)[junit-4.12.jar:4.12]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)[junit-4.12.jar:4.12]
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)[junit-4.12.jar:4.12]
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)[junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)[junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)[spring-test-5.1.10.RELEASE.jar:5.1.10.RELEASE]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:89)[.cp/:?]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)[.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:541)[.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763)[.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463)[.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209)[.cp/:?]
could not initialize proxy - no Session的异常分析一、今天在使用Junit编写项目的测试的时候,发现出现一个错误:org.hibernate.LazyInitializationException: could not initialize proxy [com.hkt.cch8.drgo.openemr.entity.Facility#3] - no Session at org.hibernate.proxy.AbstractLazyInitializer.i