How can I add a Object to a relation and persist it ?
if i do something like that
registrationInstance.addToActionType(id:id)
I get an exception
Unique index or primary key violation: "PRIMARY_KEY_E7 ON PUBLIC.ACTION_TYPE_REGISTRATIONS(ACTION_TYPE_ID, REGISTRATION_ID)"; SQL statement: insert into action_type_registrations (action_type_id, registration_id) values (?, ?) [23001-147]
EDIT:
If I write
registrationInstance.addToActionType(ActionType.get(id))
I get the same Error, but it persists – so how can I get rid of that error?
EDIT2:
If I try to remove an object:
registrationInstance.removeFromActionType(ActionType.get(id))
I receve following error (sometimes, not allways)
Eindeutiger Index oder Primarschlüssel verletzt: "PRIMARY_KEY_E7 ON PUBLIC.ACTION_TYPE_REGISTRATIONS(ACTION_TYPE_ID, REGISTRATION_ID)" Unique index or primary key violation: "PRIMARY_KEY_E7 ON PUBLIC.ACTION_TYPE_REGISTRATIONS(ACTION_TYPE_ID, REGISTRATION_ID)"; SQL statement: update action_type_registrations set action_type_id=? where registration_id=? and action_type_idx=? [23001-147]
You must add the object itself to the relationship: