[
https://jira.jboss.org/browse/JBPM-2824?page=com.atlassian.jira.plugin.sy...
]
Alejandro Guizar resolved JBPM-2824.
------------------------------------
Labels: equals hashcode jbpm3 key (was: )
Assignee: Alejandro Guizar
Resolution: Rejected
Arguably, the ProcessInstance key property should be immutable. I do not want to enforce
this condition to avoid causing trouble. However I believe it is reasonable to assume the
key will change very infrequently. Quoting the Hibernate manual: "A business key does
not have to be as solid as a database primary key candidate. Immutable or unique
properties are usually good candidates for a business key."
http://docs.jboss.org/hibernate/stable/core/reference/en/html/persistent-...
The new implementations are unlikely to impact the performance of applications, since
equals() first considers reference identity and then database id equality. Conversely
hashCode() is only invoked when you add a Token to a hash-based collection. I don't
see that happening too often.
Lastly, I would like to point out that the past implementations of hashCode() and equals()
in ProcessDefinition, ProcessInstance, Token and other classes were flawed because the
hash code and equality changed when an identifier was assigned. The flaw caused bug
JBPM-2489. I could not find a way to reliably produce different hash codes for unequal
tokens without involving the ProcessInstance hash code as well.
New implementation of equals and hashcode for ProcessInstance breaks
behaviour
------------------------------------------------------------------------------
Key: JBPM-2824
URL:
https://jira.jboss.org/browse/JBPM-2824
Project: jBPM
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: jBPM 3.2.8
Reporter: Robert Schmelzer
Assignee: Alejandro Guizar
Labels: jbpm3, key, hashcode, equals
The equals implementation of ProcessInstance now contains key, if the id is not set. The
equals implementation of Token also includes equals for ProcessInstance. This means that
setting the key properties from within a running process changes the hashcode of the Token
and therefore the Process variables will not be found anymore as long as the id of the
ProcessInstance is not found.
Furthermore it should be discussed how it affects performance to include ProcessInstance
and Processdefinition in every call of equals and hashcode for a Token.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira