Message: could not initialize proxy - no Session org.hibernate.LazyInitializationException: could no
今日用hibernate和springmvc做开发时候,遇到标题那个问题。在Dao中findById(Integer id)方法里,用getHibernateTemplate.load(entity.class,id)返回entity后,那边的转换的entity.getXX()熟悉,出现了错误。原因就是load(),有延迟加载问题,返回只是实体代理类,而用get()方法返回是实体,不会出现问题。
原创
2015-05-08 23:31:35 ·
289 阅读 ·
0 评论