gorm save method causing a select query to fire

岁酱吖の 提交于 2019-12-02 00:47:12

You must have specified in Employee mapping that empId is the primary key - that's probably the only reason for NonUniqueObjectException.

The SQL query must come from an unique constraint on empId field.

Why not using Grails'/Hibernate implicit id, are you using a legacy database with a specific mapping?

edit I don't see why would unique constraint cause NonUniqueObjectException - can you please try it without the constraint?

If the problem remains, you must have saved the object twice from the same session - no idea how it can happen, maybe by merge()-ing an Employee from earlier session.

The SQL query is caused by uniqueness constraint and it's the right thing.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!