gpt4 book ai didi

hibernate - 无法初始化代理 - 再次没有 session

转载 作者:行者123 更新时间:2023-12-04 12:25:26 25 4
gpt4 key购买 nike

查看页面时我收到这些错误日志

ERROR [TP-Processor11] (LazyInitializationException.java:42) - could not initialize proxy - no Sessionorg.hibernate.LazyInitializationException: could not initialize proxy - no Session    at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:132)    at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:174)    at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:190)    at org.osmoz.contents.model.enm.ContentType_$$_javassist_71.getDefaultShortMode(ContentType_$$_javassist_71.java)    at org.osmoz.contents.web.tapestry.components.EnmContentZone.getTemplate(EnmContentZone.java:67)    at org.osmoz.contents.web.tapestry.base.AbstractRawContentZone.getContent(AbstractRawContentZone.java:67)    at $PropertyConduit_1276091af82.get($PropertyConduit_1276091af82.java)    at org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:58)    at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:510)    at org.apache.tapestry5.internal.structure.InternalComponentResourcesImpl$1.read(InternalComponentResourcesImpl.java:496)    at org.apache.tapestry5.corelib.components.OutputRaw._$read_parameter_value(OutputRaw.java)    at org.apache.tapestry5.corelib.components.OutputRaw.beginRender(OutputRaw.java:43)    at org.apache.tapestry5.corelib.components.OutputRaw.beginRender(OutputRaw.java)    at

I know the problem is Session has been closed. But I really don't know why this error occur not so often that why I don't know the root cause is.

Enviroment:

Tapestry5, JPA, Hibernate 3.3.2.GA

I've set

<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>

在 web.xml 中

最佳答案

使用 @Transactional在用 @Service 注释的层中的方法上( Spring 服务)。

关于hibernate - 无法初始化代理 - 再次没有 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2469700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com