We have a persistence object A which has a property When we remove one object b from the list with:
and then try to persist this with:
The participant which we tried to remove is still present in the database. I thought this could be set within the persistence definition in this window: Do we have to remove the object b separately from the database or how can we achieve this? asked 18.06.2015 at 14:11 Nikel Weis |
To have this feature working you need to set an additional property on the participant List field which is not accessible from the UI: orphanRemoval=true You can set the property as follows: switch into the Java Perspective -> right click on the generated entity data class in src_dataClasses -> open with -> java editor. Find the line where the List<?> (participants) is declared. Add the orphanRemoval property.
As soon as you're typing something in the Java Editor you have to press ok on the prompt that informs that you're editing a derrived resource. This means that whenever you edit the DataClass with the UI editor, you're changes will be overwritten. So for long term it could make more sense to copy the whole java class into your normal java source code and delete the DataClass. Further informations to the orphanRemoval property can be found on stackoverflow: http://stackoverflow.com/questions/4593241/jpa-removing-item-from-list answered 23.06.2015 at 11:44 Reguel Werme... ♦♦ |
Once you sign in you will be able to subscribe for any updates here
By RSS:Markdown Basics
Tags:
Asked: 18.06.2015 at 14:11
Seen: 2,391 times
Last updated: 23.06.2015 at 11:49