Duplicate. Answeder on SO [1]
[1] https://stackoverflow.com/questions/50714462/how-ignite-performs-cache-get-operation-when-hashcode-is-overridden On Wed, Jun 6, 2018 at 10:03 AM, the_palakkaran <[email protected]> wrote: > <http://apache-ignite-users.70518.x6.nabble.com/file/t1795/Capture.jpg> > > > See the image attached. I have put keys into the cache using the equals > method as follows: > > > @Override > public boolean equals(Object obj) { > HierarchyMasterKey hierarchyMasterKey = (HierarchyMasterKey) obj; > return equalTo(this.hmCustNo, hierarchyMasterKey.hmCustNo) && > equalTo(this.hmFromDate, hierarchyMasterKey.hmFromDate) && > equalTo(this.hmParentCustNo, > hierarchyMasterKey.hmParentCustNo) && > equalTo(this.hmActNo, hierarchyMasterKey.hmActNo); > } > > (equalTo method is basically null safe equals check.) > > and hashCode is computed as below: > > @Override > public int hashCode() { > return Objects.hash(hmCustNo,hmActNo); > } > > > When I try to get from it, > the equals method won't get executed. Why is this so? How does ignite get > the key without executing equals? > > [I have a cache that has a HierarchyMasterKey and a list of HierarchyMaster > as values] > > > > > > -- > Sent from: http://apache-ignite-users.70518.x6.nabble.com/ > -- Best regards, Andrey V. Mashenkov
