SpringDataJPA中NO Session错误

us 500 - Could not write content: could not initialize proxy - no Session (through reference chain: cn.jiedada.aisell.common.UIPage["rows"]->java.util.UnmodifiableRandomAccessList[0]->cn.jiedada.aisell.domain.Employee["department"]->cn.jiedada.aisell.domain.Department_$$_jvst583_0["id"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy - no Session (through reference chain: cn.jiedada.aisell.common.UIPage["rows"]->java.util.UnmodifiableRandomAccessList[0]->cn.jiedada.aisell.domain.Employee["department"]->c

因为hibernate的底层是通过session来实现CRUD,所以当关闭EntityManager时候所以会出现这个异常

在web.xml中配置


    
    
        OpenEntityMangerInViewFilter
        class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilterclass>
    
    
        OpenEntityMangerInViewFilter
        /*
    
————————————————
版权声明:本文为CSDN博主「布谷_」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42136250/article/details/88581844
View Code

 

你可能感兴趣的:(SpringDataJPA中NO Session错误)