I created a Role entity, I would like to do CRUD operations on it. Everything works well, except the “D” (delete) operation.
I use something similar to this ObjectDB example code.
As stated in the WebPage quoted above,
An IllegalArgumentException is thrown
by remove if the argument is not a an
instance of an entity class or if it
is a detached entity.
How should I do that? What did I do wrong?
My Role entity is related to a User entity (a role can “have” several users, a user only one role). However, the Role instance I want to remove is by no means linked to any active user instances.
Thank you for your answer, but it did not help me much. Though I do think it was related to JTA.
I found out a solution however, so I ‘d like to share it here :
Instead of :
All I had to do was :
And that does the trick. Go figure.