Hibernate_problem:no Session_solve:annotation
来源:互联网 发布:js返回并重载页面 编辑:程序博客网 时间:2024/05/17 23:22
开发遇到的错误如下:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role:com.wnn.shop.category.vo.Category.categorySeconds, could not initialize proxy - no Session
原因分析:
因为默认的方式为延迟加载,即需要数据的时候再执行加载操作,具体看一看Console显示。当jsp页面想要提取信息的时候,问题就出现了,session已经关闭,所以会显示no Session。解决的方式就是立即加载。
问题解决方式:
将annotation注解放置于get*方法上,并设置@LazyCollection(LazyCollectionOption.FALSE);
0 0
- Hibernate_problem:no Session_solve:annotation
- No Retrofit annotation found
- No Retrofit annotation found. (parameter #1)
- 'mvc:annotation-driven' must have no character or element问题
- EventBus 注册错误no public methods with the @Subscribe annotation
- 'mvc:annotation-driven' must have no character or element问题
- 'mvc:annotation-driven' must have no character or element问题
- annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- Annotation
- annotation
- Annotation
- Annotation
- 关于在android studio写一个menu的笔记
- Android Studio上传library到Nexus搭建的Maven乱码问题
- JNDI概述
- Maven(四)-依赖关系(理论篇)
- MTU 理解和遇到的一些问题
- Hibernate_problem:no Session_solve:annotation
- LeetCode 495. Teemo Attacking [tag:Array][difficulty:Medium]
- jdk8 源码之HashSet 和 LinkedHashMap
- Mysql支持的索引简介
- 基于VS2010的MFC动态菜单
- IP设置的两种方式以及最少配置内容
- ios::app与ios::ate的区别
- 用conda创建python虚拟环境
- Openjudge-noi 2985 数字组合