2 Replies Latest reply on Jul 21, 2008 3:31 AM by Pascal Verdage

    Remove child executions in persisted mode

    Pascal Verdage Newbie

      Hi,

      in persisted mode, removing a child execution from an ExecutionImpl object thorws an exception:

      protected Collection<ExecutionImpl> executions;
      
       public void removeExecution(Execution child) {
       if (executions!=null) {
       if (executions.remove(child)) {
       /* ... CODE ... */
       } else {
       throw new PvmException(child+" is not a child execution of "+this);
       }
       }
       }


      In persisted mode, 'executions' doesn't contain ExecutionImpl object but hibernate proxies.
      A solution to make the Collection's methods work is to override equals and hashCode methods of ExecutionImpl.
      I tried with only the dbId and it worked, but this breaks the non persisted mode.

      Do you have ideas on which parameters to use to make both modes pass and still have a unique hashCode ?

      Regards,
      Pascal