1、ssh全注解当我们继承hibernatedaosupport类时出现如下错误信息:
Caused by: java.lang.IllegalArgumentException: 'sessionFactory' or 'hibernateTemplate' is required
解决方法:在applicationContext.xml配置文件中的scheme中加入: default-autowire="byName"
2、在实体类中采用全注解,并且在配置文件中设置hibernate.hbm2ddl.auto为create或update,hibernate.show_sql为true时,不自动打印sql语句
解决方法: 检查自己的配置文件applicationContext.xml,看scheme中有没有设置:default-lazy-init="true",如果有,去掉即可。
本文解决两个常见问题:一是使用SSH框架时继承hibernatedaosupport类出现的'sessionFactory'或'hibernateTemplate'未配置问题;二是全注解方式下Hibernate不自动打印SQL语句的问题。
858

被折叠的 条评论
为什么被折叠?



