You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Andre Scheunemann <an...@toonboom.com> on 2007/06/08 19:40:45 UTC
Question about JCR nodes and hash code.
Hello,
I have a situation where I'm building a cache of JCR nodes and I use
node.hashCode() as my key.
This works fine for local repository nodes but fails with a remote
repository accessed through RMI.
With the remote repository I get a different hash code for the same node
for each search that I perform.
Shouldn't the hash code be always the same for a given node even for
remote repositories ?
Regards,
Andre
Re: Question about JCR nodes and hash code.
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 6/8/07, Andre Scheunemann <an...@toonboom.com> wrote:
> I have a situation where I'm building a cache of JCR nodes and I use
> node.hashCode() as my key.
Note that it entirely possible for two different nodes to have the
same hash code! I would strongly advice against using the hash code
for anything like that.
How about using the path of the node as the key? Alternatively, if
your node are all referenceable, you could use UUIDs as keys.
BR,
Jukka Zitting