I have to make a composite key in my spring boot service, using two columns (floorid
& ticketid
) from an existing table to prevent duplicate records.
But suddenly I get the following error when the save
call is made:
Error is identifier of an instance of com.ge.current.digitaltwin.devicemap.entity.DeviceMapCompEntity was altered from com.ge.current.digitaltwin.devicemap.entity.DeviceMapId@3f3b65f9 to com.ge.current.digitaltwin.devicemap.entity.DeviceMapId@91bc6f2; nested exception is org.hibernate.HibernateException: identifier of an instance of com.ge.current.digitaltwin.devicemap.entity.DeviceMapCompEntity was altered from com.ge.current.digitaltwin.devicemap.entity.DeviceMapId@3f3b65f9 to com.ge.current.digitaltwin.devicemap.entity.DeviceMapId@.
Is there another way to prevent duplicate records without changing the code and bymaking some changes in backend?
I don't know what is happening. Can anybody help me on this?