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

    Problem with delete through helper method in SessionBean

    Holger Johanndeiter Newbie

      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)


      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?