HK0000000001
??????è§?è§??§???????é????????
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
Caused by: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:71)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:253)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.springframework.orm.hibernate3.HibernateAccessor.flushIfNecessary(HibernateAccessor.java:390)
at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:373)
at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:784)
at org.springframework.orm.hibernate3.HibernateTemplate.delete(HibernateTemplate.java:780)
at com.weiao.crm.dao.impl.IBaseDaoImpl.delete(IBaseDaoImpl.java:46)
at com.weiao.crm.biz.impl.IBaseBizImpl.delete(IBaseBizImpl.java:40)
at com.weiao.crm.biz.impl.ICustBizImpl.delete(ICustBizImpl.java:51)
at com.weiao.crm.web.action.CustAction.doCustDel(CustAction.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:404)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:229)
at 执行hibernate删除方法时,由于数据库此表中没有设置自动标识,所以只能使用字符串删除,传入custNo与custName值,传入的custNo为英文与数字正常,但传入custName值时中文出现乱码,转换编码写了encoding拦截,也在struts2中设置了struts.i18n.encoding编码,但是传进去的值还是乱码。
<img onclick="del('cust!doCustDel.action?cust.custNo=${c.custNo }&cust.custName=${c.custName }');" title="删除" src="/crm/images/bt_del.gif" class="op_button" />

解决方案 »

  1.   

    传入action中获取的值已经是乱码? 
    一、页面的编码utf-8
    二、配置个过滤器 spring已经提供了一个过滤器
    三、最好统一编码为utf8
      

  2.   

    页面编码--数据库编码--Struts2编码要一至
      

  3.   

    建议从基本熟悉,考虑普通jsp传值是怎么处理编码的,再进行深层次的架构