@Options(useGeneratedKeys = true, keyProperty = "instanceId", keyColumn = "instance_id")The field corresponding to the primary key set by default in the @Options annotation is named id. In our table, the primary key is named instance_id, so we need to set keyProperty and keyColumn to the fields we want:
The meaning of this annotation is to put the data from the instance_id field into the instanceId member variable of the incoming object.
After calling the insert method, the @Options annotation will automatically set an auto-incremented value for the primary key field of the object corresponding to the table, which can be obtained directly from this object.
Returns the incremented value of the primary key of the newly inserted data.
Guess you like
Origin blog.csdn.net/old_wzhou/article/details/78337377
Recommended
Ranking