首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

ssh 整合常见异常

2013-09-11 
ssh 整合常见错误今天工作时:在数据持久层更hibernate打交道时写更新语句使用this.getHibernateTemplate()

ssh 整合常见错误

今天工作时:在数据持久层更hibernate打交道时写更新语句使用this.getHibernateTemplate().update(user)发现不能更新,然后查找资料后应该是要获取到主键,对这个update()和saveOrupdate()不太了解,然后在iteye上找到2004年的一个帖子http://www.iteye.com/topic/2712讲的很详细有很多帮助,最后由于自己的取舍,就是用了hql语句 this.getHibernateTemplate().bulkUpdate(hql)进行更新,然后自己不小心发现不能更新报错:org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query ,很奇怪感觉自己语句对这嘞啊,搜了下ssh整合时常见错误。记录下(也许以后会遇到。。。。):

1.
org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
原因:<id>元素配置不正确,<id>元素缺少其子元素<generator></generator>的配置。解决方法:<id>元素映射了相应数据库表的主键字段,对其子元素<generator org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
Caused by: org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
9.
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.transaction.interceptor.TransactionProxyFactoryBean] for bean with name 'userService' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractSingletonProxyFactoryBean
Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/AbstractSingletonProxyFactoryBean
方案:没加 spring 2.0 aop libraries
10.
org.apache.jasper.JasperException: Unable to compile class for JSP:
方案:jsp网页中的java代码有问题
11.
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CompanyController' defined in class path resource [com/company/test/company-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'methodNameResolver' of bean class [com.company.action.CompanyController]: Bean property 'methodNameResolver' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'methodNameResolver' of bean class [com.company.action.CompanyController]: Bean property 'methodNameResolver' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
控制器没继承MultiActionController


我的异常网推荐解决方案:org.springframework.beans.factory.BeanCreationException:,http://www.myexception.cn/j2ee/10759.html
我的异常网推荐解决方案:org.apache.jasper.JasperException: Unable to compile class,http://www.myexception.cn/j2ee/2308.html

热点排行