java - 不同web应用操作同一张表,hibernate出现索引重复异常?
PHPz
PHPz 2017-04-18 10:11:43
0
3
571
PHPz
PHPz

学习是最好的投资!

reply all(3)
巴扎黑

This problem will not occur if

does not follow the hibernate有关系的。
MySQLIntegrityConstraintViolationException 外键约束冲突。
是数据库层面出错了。可以通过堆栈确定一下调用过程,如果没有insert/update operation.


I don’t see any reason behind the logic you gave. You can use error logictry catch包起来,在catch中增加条件断点e.getClass().getName().contains("MySQLIntegrityConstraintViolationException")
When an error occurs and analyze the existing data, I think the problem will be located soon.

黄舟

MAC is a unique index. The exception reported here refers to a unique index conflict caused by inserting the same value, which is an exception at the database level.

As for why this exception is caused, it depends on how the code is written.

It is suspected that there is a problem with this polling process. The second request may have been sent before the first request has returned, and then the parameters passed in are repeated, resulting in a repeated insertion exception.

伊谢尔伦

The above two points are very clear... This is an error caused by your failure to control the business level. Specifically, only people with code can solve it.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template