Really truly ;) , try this with junit, and JR 1.2.2 (1.3 also does it):<br><br><br>public void testIt() throws Exception {<br> Repository repo = new TransientRepository();<br> Session sess = repo.login(new SimpleCredentials("foo", "password".toCharArray()));
<br> Node root = sess.getRootNode();<br> <br> for (int i = 0; i < 10; i++) {<br> root.addNode( "" + i + System.currentTimeMillis(), "nt:unstructured" );<br>
sess.save();<br> }<br> <br> <br> Query q = sess.getWorkspace().getQueryManager().createQuery( "select * from nt:unstructured", Query.SQL);<br> QueryResult qr = q.execute();<br>
NodeIterator ni = qr.getNodes();<br> <br><br> //check we get at least something back from the query<br> assertTrue(ni.hasNext());<br> assertNotNull(ni.next());<br> assertNotNull(
ni.next());<br> assertNotNull(ni.next());<br>}<br><br>And start it up, try it about 10 times in a row, at least one time you will see a failure (ie it won't return anything from the query) - and then a subsequent time it just wont start, wait a few seconds, and then it will work again.
<br><br>Very very wierd, but somewhat relieved its not my own confused code, this is as simple as I can make it. I can only imagine there is some index sync issue still at play. Unfortunately, there is no way to wrap this up as a proper test, as it needs to startup fresh each time to reliably reproduce this (seperate JVM process each time).
<br><br>(and this will happen on any OS, I thought it was just linux, but have tried it on mac, windows etc). <br><br>