[hibernate-users] Building a smart cascade deletion routine

Josh Long starbuxman at gmail.com
Fri Apr 4 01:33:37 EDT 2008


Hello all,

I'm looking for a way to guarantee a cascade deletion. I am generating
everything from an ER tool and thus all associations are navigable
from either side of the relationship. Does any one have any experience
crawling such an object graph to orphan off any foreign keys and then
ensure the correct deletion of a record?

I know that I can get at the runtime meta data by casting to
HibernateProxy. Is there any case where I wouldn't be able to cast to
HibernateProxy? I understand that I might end up loading every lazy
object in the system if I'm not careful. Is there a way to seize onto
the runtime information and gleem which side oft he relationship is
the owning side, for example. Does it make a difference since no
associations are set to be cascade orphan delete?

I am working with JPA on JBoss,so I have access tot he underlying
Hibernate engine if need be.

Any input / gotchas would be appreciated!

Thanks,
-- 
Joshua Long
Sun Certified Java Programmer
http://www.joshlong.com/



More information about the hibernate-users mailing list