1 Reply Latest reply on Jun 28, 2006 2:29 AM by squishy

    Problem with delete through helper method in SessionBean

    squishy

      Hello,
      I have the following problem:

      I have a User entity with a ManyToMany relationship to Group, persist and merge cascading.
      I have a UserMgrBean session bean to access the Users.
      If i delete a User with a relationship by calling
      (umgr being a UserMgr instance)

      umgr.delete(umgr.get(1));
      

      It works fine, user is deleted along with relationship.

      However, in UserMgr i also have a method that actually does the same...

       public void DWRDelete(int userId) {
       manager.remove(manager.find(User.class, userId));
       }
      


      ... but results in this error:

      org.hibernate.ObjectDeletedException: deleted entity passed to persist: [ejbframe.entity.User#<null>]


      If i call DWRDelete on a User without a relationship it works.

      That method is for when i access the bean via javascript and i cant do without it.

      How can i fix this?