adding to a loaded list is not reflected in the .size() method (and addAll() is possibly also affected)
I created ExtraLazyTest.testExtraLazySet in the test suite that shows the issue.
User person = (User) s.get(User.class, gavin.getName());
new Document( "Fresh", "word", person );
System.out.println("Writing out the persons documentes (Set). Expected to find 3 but it only contains 2.");
for (Iterator iter = person.getDocuments().iterator(); iter.hasNext()
{ // changes should be written at this time...
Document doc = (Document) iter.next();
System.out.println("phoneNumber: " + doc);
}
assertTrue(person.getDocuments().size() == 3);
Changing PeristentSet.endRead() to:
public boolean endRead() {
set.addAll(tempList);
tempList = null;
return afterInitialize(); // ensures that operationQueue is considered.
}
makes it work.
its actually not really an issue limited to size() but that .iterate() does not return the actually added objects.