In the new project, testers respond to a simple save function, sometimes useful, sometimes unsuccessful, and need to retry many times.
I looked at the original code logic, did not find any problems, conducted a local test, did not find the case of unsuccessful.
By looking through the official environment log, found some ID duplicate error, the original is this engaged.
The ID comment for the original entity class is written like this:
@GenericGenerator (name= "generator", strategy= "increment") @Id @GeneratedValue (generator= "generator") @ Column (name = "id", unique = true, Nullable = false) public Long GetId () {return this.id;}
There is no problem with the local single tomcat, and the problem is in the cluster that can be put into the production environment.
A detailed explanation can beseen: http://articles.e-works.net.cn/pc_server/article101508.htm
@Id @GeneratedValue (strategy=generationtype.identity) @Column (name = "Id", unique = true, Nullable = False) Public Long getId () { return this.id; }
Database primary key conflict resolution