This content has been marked as final.
Show 5 replies
-
1. Re: How to cause related entities to update when base entity
epbernard Sep 19, 2006 7:34 PM (in response to a_titov82)1. is not possible this is not how you would work in a object model (wo persistence)
2. can be done through cascade=CascadeType.REMOVE on the @OneToMany association -
2. reference integrity
a_titov82 Sep 20, 2006 1:42 AM (in response to a_titov82)1. is not possible this is not how you would work in a object model (wo persistence)
But how can I provide reference integrity? If placeOfWork cannot be set to null automatically then it is possible to have references to non-existence objects. Especially in MySql database with MyISAM engine which does not support foreign keys... -
3. Re: How to cause related entities to update when base entity
epbernard Sep 20, 2006 4:36 PM (in response to a_titov82)do a query that load the associated object and remove them
-
4. Re: How to cause related entities to update when base entity
a_titov82 Sep 21, 2006 2:20 PM (in response to a_titov82)do a query that load the associated object and remove them
But where should I do that? If the base entity is removed by cascade, what then? The only way I found is to create an annotated method which will be called when entity is removed. But it must be coded manually and this is error prone, I think. -
5. Re: How to cause related entities to update when base entity
epbernard Sep 21, 2006 3:48 PM (in response to a_titov82)Looking at your specific problem, an employee without organization is not an employee anyway, it should be removed ;-)