jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Herman" <MHer...@NBME.org>
Subject RE: Session.refresh(true) behaviour
Date Thu, 18 Aug 2011 12:22:02 GMT
As far as the repository is concerned that node is gone.  If the
.refresh(true) doesn't invalidate the cached n2/n3 right away, I would expect
a repositoryexception when you try and save().  To prevent this type of issue
you may want to look into locking[1].

[1] http://www.day.com/specs/jcr/2.0/17_Locking.html


-----Original Message-----
From: David Buchmann [mailto:david.buchmann@liip.ch]
Sent: Thu 8/18/2011 7:16 AM
To: users@jackrabbit.apache.org
Subject: Session.refresh(true) behaviour
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

hi,

the documentation [1] [2] is not very explicit how conflicts should be
resolved. i wrote some simple test code, see below. is it correct that
whenever i delete something on the server or move it somewhere else, the
refresh(true) still changes the modified node to be deleted?


Session s = repository.login(sc,workspace);
Node n = s.getNode("/test");
Node n2 = n.addNode("childname", "nt:folder");
s.save();

// delete the node in a separate session
Session s2 = repository.login(sc,workspace);
s2.removeItem("/test/childname");
// or just s2.move("/test/childname", "/xy");
s2.save();

// add a child to the node in the first session
Node n3 = n2.addNode("deepchild");

// keep local changes
s.refresh(true);
// but our local change "create a node" is lost
System.out.println(n3.getPath());


cheers,david

[1] http://www.day.com/specs/jcr/2.0/10_Writing.html#10.11.1%20Refresh
[2]
http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#re
fresh(boolean)
- -- 
Liip AG // Agile Web Development // T +41 26 422 25 11
CH-1700 Fribourg // PGP 0xA581808B // www.liip.ch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5M9H0ACgkQqBnXnqWBgIsZ7ACcC/5FomxChgvw7opEoxRS6LQk
mw8AoKBwWr2Ur3iwrkov3ucX1kzSur1F
=Q5z5
-----END PGP SIGNATURE-----



Mime
View raw message