hello everyone,
I am searching for a way out to set NULL for the child upon deletion of the
parent using hibernate annotations. Can some one please guide me on this? The
annotation used presently in Table1.java is shown below and CascadeType.ALL
doesn't even prevent the child from being deleted when the parent is deleted
(as claimed in the page 10 of
http://www.laliluna.de/download/ejb3-struts-tutorial-en.pdf).
@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER, mappedBy="table1",
targetEntity=Table2.class)
| public Set getTable2s() {
| return this.table2s;
| }
By using the following block in Table1.hbm.xml, it is working the desired way.
That is, it sets the child as NULL when the parent is deleted.
<set name="table2s" cascade="none" lazy="true">
| <key column="link2one" />
| <one-to-many class=".Table2" />
| </set>
Is there an equivalent for the same in EJB3 annotations?
Thank you,
Ajeeth Kiran
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079970#4079970
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079970
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user