从上午到下午一直在解决这个问题,具体原因查Google有很多方法却都不适合,大概的意思是前后的类型不配合,现在引用的从 国外的论坛中发现的大概原因
I just resolved this problem, the issue was that I had the wrong data type for my primary key in the entity's .hbm.xml file.
The underlying database table (SQL Server) has a primary key column of bigint. This column is also an identity field.
My original mapping config looked like this:
with this configuration I received the exception
identifier of an instance of ...[class name]... was altered from 1670012 to 1670012
I modified the mapping config to be:
and it works now.