i've got the same exact issue...
anyone know why?
I am looking for any possibility to specify the order of cascade-delete. Is it possible to tell the container to delete child records first and then delete the parent target? I do not ask for the solution. I just ask is it possible or not.
Thanks and cheers!
if you turn on the CMP debug output, you can see what Jboss does.
it first nulls all the FK's. then deletes the tables...so if they do that, then delete order doesnt matter. The problem is, as i discovered, if the child table has the FK as a PK. clearly you cant null the PK...and then the cascade delete bombs. my workaround : i'm removing the FK consraint on my pk, and adding another non pk column as the fk, so it can be nulled. messy, but it does roll back should things go awry.
its kinda counter intuitive that they null all the child FK's, cuz thats a bunch of updates, and then deletes...when if it just deleted in the right order to being with, there would be no issue, and less db activity. i guess the question is, how can the container discern the table dependencies? maybe thats why they null the fk's, then delete in any order..maybe it cant determine the delete order..
i agree with you, that it would be nice to specify the delete order..even nicer if it just figured it out for you.
Thank you for your comments. For now, I will be deleting children from application until a container based feature is discovered/developed. I am glad I was not alone in looking for this feature.