首页 > 数据库技术 > 详细

springboot使用jpa,删除功能sql报错解决

时间:2017-09-04 19:32:22      阅读:637      评论:0      收藏:0      [点我收藏+]

springboot使用jpa时报错:

 只有删除时报错了,

"data": "删除失败,原因:Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure\n\nThe last packet successfully received from the server was 190,731 milliseconds ago. The last packet sent successfully to the server was 4 milliseconds ago.",
"success": false

 

解决方案:增加了配置:&failOverReadOnly=false

技术分享

 

对应中文环境,通常mysql连接URL可以设置为:
jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=gbk&autoReconnect=true&failOverReadOnly=false

在使用数据库连接池的情况下,最好设置如下两个参数:
autoReconnect=true&failOverReadOnly=false

 

springboot使用jpa,删除功能sql报错解决

原文:http://www.cnblogs.com/mabiao008/p/7475076.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!