今天出现了这个问题:

org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; nested exception is org.hibernate.exception.DataException: Could not execute JDBC batch update
org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:639)
org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:789)
org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:663)
org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
com.sun.proxy.$Proxy20.updateNews(Unknown Source)

....

经过测试发现应该是:保存的时候有个字段content,存的数据长度超过了数据库中定义的长度,如果保存的字段长度小的时候就没有问题, 这个字段是text类型的, 把这个字段边的更长longtext就可以存储更长 数据了 2的32次方

如果喜欢作者的文章,请关注"写代码的猿"订阅号以便第一时间获得最新内容。本文版权归作者所有,欢迎转载.

DataIntegrityViolationException的更多相关文章

  1. 【异常】Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationException

    Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationException ...

  2. org.springframework.dao.DataIntegrityViolationException:

    数据库用的hibernate,开发工具用的myeclipse,使用开发工具连接数据库生成hibernate基于xml的po类,运行时报org.springframework.dao.DataInteg ...

  3. org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [null]; nested exception is org.hibernate.

    今天报了这个异常,这是页面报的 org.springframework.dao.DataIntegrityViolationException: could not execute statement ...

  4. 【hibernate】报错:org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement

    报错如下: org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a ...

  5. 报错org.springframework.dao.DataIntegrityViolationException

    最简单的原因可能是数据库外键字段选择了不能为空, 改为允许为空就行了.

  6. Spring Boot中的事务管理

    原文  http://blog.didispace.com/springboottransactional/ 什么是事务? 我们在开发企业应用时,对于业务人员的一个操作实际是对数据读写的多步操作的结合 ...

  7. AppFuse3.5对接oracle数据库

    AppFuse是一个使用Java语言开发web应用系统的集成框架.java开发人员最头痛的事情就是面对大量的框架不知该如何选择.这些框架性能如何,兼容性如何等等都需要筛选比较.Appfuse作者Mat ...

  8. Spring MVC异常处理详解

    Spring MVC中异常处理的类体系结构 下图中,我画出了Spring MVC中,跟异常处理相关的主要类和接口. 在Spring MVC中,所有用于处理在请求映射和请求处理过程中抛出的异常的类,都要 ...

  9. 【问题排查记录】Field 'id' doesn't have a default value;

    错误信息: org.springframework.dao.DataIntegrityViolationException: StatementCallback; SQL [delete from t ...

随机推荐

  1. rabbit入门教程

    简介 rabbitmq是一个消息代理系统,为应用提供一个通用得消息发布,接受平台,为应用提供非阻塞的消息系统,方便进行异步处理. 优点 消息的可靠性.持久化消息,消息接受确认,消息重传等可靠机制. 灵 ...

  2. Jquery样式

    css样式只有一个的时候: $(function(){ $('p').css('background-color','green'); }) css样式有多个的时候: $(function(){ $( ...

  3. 让Tomcat告别频繁重启

    在网站开发过程中,有一个很烦的问题就是每次我们在项目里增加几行代码,然后我们企图在浏览器中查看修改后的变化时,却发现浏览器的内容并不变化,于是我们只能通过频繁的重启tomcat来获得最新的效果,其实这 ...

  4. 安卓---TextVies、Button、EditText

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  5. 学习ASP.NET Core Razor 编程系列十——添加新字段

    学习ASP.NET Core Razor 编程系列目录 学习ASP.NET Core Razor 编程系列一 学习ASP.NET Core Razor 编程系列二——添加一个实体 学习ASP.NET ...

  6. BZOJ_4804_欧拉心算_欧拉函数

    BZOJ_4804_欧拉心算_欧拉函数 Description 给出一个数字N Input 第一行为一个正整数T,表示数据组数. 接下来T行为询问,每行包含一个正整数N. T<=5000,N&l ...

  7. BZOJ_3174_[Tjoi2013]拯救小矮人_贪心+DP

    BZOJ_3174_[Tjoi2013]拯救小矮人_贪心+DP Description 一群小矮人掉进了一个很深的陷阱里,由于太矮爬不上来,于是他们决定搭一个人梯.即:一个小矮人站在另一小矮人的 肩膀 ...

  8. golang 中 string 转换 []byte 的一道笔试题

    背景 去面试的时候遇到一道和 string 相关的题目,记录一下用到的知识点.题目如下: s:="123" ps:=&s b:=[]byte(s) pb:=&b s ...

  9. 对于zuul服务网关框架资料整理

    本次博客只是整理了一些 看过的博客.源码等 zuul入门(1)zuul 的概念和原理 https://www.cnblogs.com/lexiaofei/p/7080257.html 深入理解Zuul ...

  10. Win10安装cygwin并添加apt-cyg

    1.去Cygwin官网:https://www.cygwin.com/ 进入上图的install链接(下图),根据自己的电脑选择32位还是64位 我选择了一个32位的: 一直下一步下图: 163镜像链 ...