0 Replies Latest reply on Dec 10, 2008 7:33 AM by icordoba

    Cascade.REMOVE not working between EJBs in different jars

    icordoba

      Hi there,
      I am having a problem with Hibernate which I don't know if it is a problem or the regular behaviour.
      Cascade.REMOVE is working fine for me but only between EJBs in the same .JAR (several jars, each for a differente "module" are packed in an .ear for my application)
      I deploy a .ear file with EJBs grouped in different jars. Some times there are MANY-TO-ONE referentes from EJBs in these different jars. Every thing works OK with these EJBs even they are placed in different jars. My only problem is that removing a EJB will not remove the corresponding side of the relation y the EJB is in another jar file.

      The only way I have found to solve this is manually adding "on delete cascade" in the MySQL schema, but it is important for me that the database scheme created by JBoss/Hibernate when I deploy de .ear is fully funcional not requiring manual modifications.

      By the way, should Hibernate add "on delete cascade" constraint when creating the data base schema? It isn't now, but it manages OK cascade removing in EJBs in the same jar anyway.

      I don't use any Hibernate specific feature. Just EJB3 annotations and I am using JBoss 4 as EJB container.

      Thanks for any help/ideas

      Ignacio