ssh框架中Hibernate 关联表 的问题解决

Posted 陈晨飞抵

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh框架中Hibernate 关联表 的问题解决相关的知识,希望对你有一定的参考价值。

1.Hbernate映射关系 no session or session was closed问题

在项目的web.xml的前面添加

<!-- 配置Spring的OpenSessionInViewFilter以解决懒加载异常的问题 -->
<filter>
<filter-name>OpenSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>OpenSessionInViewFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>

以此来延长数据库会话session时间

2.假如出现

org.hibernate.InstantiationException: No default constructor for entity: com.tks.skyproject.model.ImplementLogAttach

这种错误  

  应该检查  javabean中是否有  相应的构造方法 

  错误原因  : 该方法缺少构造方法 

 

以上是关于ssh框架中Hibernate 关联表 的问题解决的主要内容,如果未能解决你的问题,请参考以下文章