1 Reply Latest reply on Nov 21, 2009 11:35 AM by sebastian.s

    [jBPM 4.2]

    xalperte

      I'm trying to locate a ProcessInstance inside a List container using the "contains" method but the instance is not found.

      Looking in the equals method of the ExecutionImpl I saw that the EqualsUtils.equals static method is used for that purpose and it's using the object pointer instead the object hibernate key to compare objects.

      I think the implementation of the EqualsUtils.equals method should compare objects using its hibernate key, doesn't it?

      Idea:

      ClassMetadata entity1Metadata = sessionFactory.getClassMetadata(entity1.getClass());
      Object entity1Key = entity1Metadata.getIdentifier(entity1, EntityMode.POJO);
      
      ClassMetadata entity2Metadata = sessionFactory.getClassMetadata(entity2.getClass());
      Object entity2Key = entity2Metadata.getIdentifier(entity2, EntityMode.POJO);
      
      return entity1Key.equals(entity2Key)