ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Ellery <dave.ell...@leonardo.com>
Subject Re: Automatic Persistence cache: Key exists in cache, but not value
Date Mon, 06 Jul 2015 13:03:19 GMT
Just one last follow up on this - UUIDs worked out of the box, very welcome surprise!

On 2015-07-03 12:00 PM, Dave Ellery wrote:

so you and I were on the right track, it was actually the hashCode that was the issue (which
makes sense), just had to change the hashCode generation in the Key class, also I changed
the datatype to byte[], instead of object - I changed the .equals as well, but it never actually
uses it (in lieu it uses the hashCode)

Before:


/** {@inheritDoc} */
@Override public int hashCode() {
    int res = myid != null ? myid.hashCode() : 0;

    return res;
}


After: using Arrays.hashCode to calculate the correct hashCode based on the array values (ref:
http://stackoverflow.com/questions/1058149/using-a-byte-array-as-hashmap-key-java )


/** {@inheritDoc} */
@Override public int hashCode() {
    int res = myid != null ? Arrays.hashCode(myid) : 0;

    return res;
}


Now to get UUIDs to work!


On 2015-07-03 09:16 AM, Dave Ellery wrote:

Val - thanks, I actually had a similar thought to that last night, that the comparison is
somehow broken.

this was generated by the 1.1 schema tool, MySQL5.6 - what I actually need to do is get UUIDs
working from a binary(16) column, but one step at a time!

Will try out your suggestion and report back!

On 2015-07-02 05:50 PM, vkulichenko wrote:

Dave,

It looks like you use byte array as an inner object of the key. Equals on a
byte array will return true only if it's compared with the same instance, so
your UuidTestKey.equals() implementation is wrong right now. Please try
using Arrays.equals(..) method for array comparison.

Was this code generated by schema utility? What is the database type for
UuidTestKey.myid field?

-Val



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Automatic-Persistence-cache-Key-exists-in-cache-but-not-value-tp605p606.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--
--
Dave Ellery
Senior Architect / Leonardo<http://www.leonardo.com><http://www.leonardo.com><http://www.leonardo.com><http://www.leonardo.com>


office: +1 416 885 1450
email: dave.ellery@leonardo.com<mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com>
[cid:part3.02060901.07030009@leonardo.com]<http://www.leonardo.com/products/vizlly/><http://www.leonardo.com/products/vizlly/><http://www.leonardo.com/products/vizlly/><http://www.leonardo.com/products/vizlly/>
[cid:part5.05020003.04020103@leonardo.com]<http://www.leonardo.com><http://www.leonardo.com><http://www.leonardo.com><http://www.leonardo.com>
[cid:part7.06050708.01090709@leonardo.com] <http://www.twitter.com/vfmleonardo><http://www.twitter.com/vfmleonardo><http://www.twitter.com/vfmleonardo><http://www.twitter.com/vfmleonardo>
 [cid:part9.02030603.08020808@leonardo.com] <http://www.facebook.com/vfmleonardo><http://www.facebook.com/vfmleonardo><http://www.facebook.com/vfmleonardo><http://www.
facebook.com/vfmleonardo>  [cid:part11.07030600.03060106@leonardo.com] <http://www.linkedin.com/company/352778><http://www.linkedin.com/company/352778><http://www.linkedin.com/company/352778><http://www.linkedin.com/company/352778>
 [cid:part13.05030604.07050406@leonardo.com] <http://www.youtube.com/vfmleonardoonline><http://www.youtube.com/vfmleonardoonline><http://www.youtube.com/vfmleonardoonline><http://www.youtube.com/vfmleonardoonline>
 [cid:part15.03000909.04070804@leonardo.com] <http://blog.leonardo.com/><http://blog.leonardo.com/><http://blog.leonardo.com/><http://blog.leonardo.com/>
 [cid:part17.03040109.09050200@leonardo.com] <http://instagram.com/leonardo_social><http://instagram.com/leonardo_social><http://instagram.com/leonardo_social><http://instagram.com/leonardo_social>
 [cid:part19.03070602.00090804@leonardo.com] <https://plus.google.com/b/
101309675710269958115/><https://plus.google.com/b/101309675710269958115/><https://plus.google.com/b/101309675710269958115/><https://plus.google.com/b/101309675710269958115/>


--
--
Dave Ellery
Senior Architect / Leonardo<http://www.leonardo.com><http://www.leonardo.com>


office: +1 416 885 1450
email: dave.ellery@leonardo.com<mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com><mailto:dave.ellery@leonardo.com>
[cid:part3.02060608.06070604@leonardo.com]<http://www.leonardo.com/products/vizlly/><http://www.leonardo.com/products/vizlly/>
[cid:part5.04010602.03090606@leonardo.com]<http://www.leonardo.com><http://www.leonardo.com>
[cid:part7.07000604.02090503@leonardo.com] <http://www.twitter.com/vfmleonardo><http://www.twitter.com/vfmleonardo>
 [cid:part9.04070702.03080401@leonardo.com] <http://www.facebook.com/vfmleonardo><http://www.facebook.com/vfmleonardo>
 [cid:part11.04080403.05060901@leonardo.com] <http://www.linkedin.com/company/352778><http://www.linkedin.com/company/352778>
 [cid:part13.03010602.07060404@leonardo.com] <http://www.youtube.com/vfmleonardoonline><http://www.youtube.com/vfmleonardoonline>
 [cid:part15.07080806.05010100@leonardo.com] <http://blog.leonardo.com/><http://blog.leonardo.com/>
 [cid:part17.06060002.00070700@leonardo.com] <http://instagram.com/leonardo_social><http://instagram.com/leonardo_social>
 [cid:part19.02050108.06080303@leonardo.com] <https://plus.google.com/b/
101309675710269958115/><https://plus.google.com/b/101309675710269958115/>


--
--
Dave Ellery
Senior Architect / Leonardo<http://www.leonardo.com>


office: +1 416 885 1450
email: dave.ellery@leonardo.com<mailto:dave.ellery@leonardo.com>
[cid:part3.09020000.01030304@leonardo.com]<http://www.leonardo.com/products/vizlly/>
[cid:part5.08080102.08070009@leonardo.com]<http://www.leonardo.com> [cid:part7.06090203.08070408@leonardo.com]
<http://www.twitter.com/vfmleonardo>  [cid:part9.07070900.08010101@leonardo.com] <http://www.facebook.com/vfmleonardo>
 [cid:part11.01010702.03020003@leonardo.com] <http://www.linkedin.com/company/352778>
 [cid:part13.02000504.05050401@leonardo.com] <http://www.youtube.com/vfmleonardoonline>
 [cid:part15.01080103.00010203@leonardo.com] <http://blog.leonardo.com/>  [cid:part17.09070507.08000400@leonardo.com]
<http://instagram.com/leonardo_social>  [cid:part19.08020703.04000409@leonardo.com]
<https://plus.google.com/b/101309675710269958115/>

Mime
View raw message