When writing (creating) a User, a Group and a Membership in one step an Exception is caused due to:
"Referential integrity constraint violation: "ACT_FK_MEMB_GROUP: PUBLIC.ACT_ID_MEMBERSHIP FOREIGN KEY(GROUP_ID_) REFERENCES PUBLIC.ACT_ID_GROUP(ID_)"
this is because the Implementation of saveUser() and saveGroup() method from the DbIdentityServiceProvider differ from the Implementation of createMembership()
saveUser() and saveGroup() add the Entitys into the cache, whereas the createMembership() method is trying to write direct into the Database. This lead to the Exception above, when you try to create all of them in one step.
My use case is a new identity service plugin which delegates most requests to the Camunda DBIdentitiyServiceProvider. During authentication we want to update the Camunda DB.
To fix that, the createMembership() method should be refectored to behave in the same way like saveUser() and saveGroup() (And write the entity into the cache rather than into the db). Moreover a getter method for userId and groupId are necessary so that the db driver can access the Id's when writing them into the db.