[jboss-user] [JBoss Seam] - Bidirectional OneToMany removal of related entities
ngeadah
do-not-reply at jboss.com
Thu Nov 30 16:53:49 EST 2006
If I have a bidirectional OneToMany and I remove a related entity from the Set, then call "persist", is the removed related entity supposed to get deleted from the database or not? In my case it is not getting deleted, altough I was under the impression that persist would reflect all changes made to the object graph (my cascade is "ALL"). The removal from the Set is definitely occuring - it's just not getting reflected in the DB.
some code to explain:
Parent:
| @OneToMany(mappedBy="form", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
| public Set<BaseSchedule> getSchedules()
| {
| return schedules;
| }
|
Child:
| @ManyToOne
| public BaseForm getForm()
| {
| return form;
| }
|
Removal code:
|
| form.getSchedules().remove(someSchedule);
| em.persist(form); // This is NOT deleting the child
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3990276#3990276
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3990276
More information about the jboss-user
mailing list