OpenNTF / org.openntf.domino

Open replacement for lotus.domino package in HCL Domino
Apache License 2.0
66 stars 34 forks source link

Document returns wrong parent database after performing a copyToDatabase() #152

Closed markleusink closed 5 years ago

markleusink commented 8 years ago

It appears that the parentDatabase reference isn't updated after copying a document using copyToDatabase(). The code below outputs the same replica ID for both the source and target parent databases.

If you run the same code using the lotus.domino objects, it returns the corrent (different) replica id's.

String dbPath = "some-db-not-current.nsf";

Database dbSrc = XSPUtil.getCurrentSession().getDatabase("", dbPath);
Document docSrc = dbSrc.getAllDocuments().getFirstDocument();

Database dbCurrent = XSPUtil.getCurrentDatabase();
Document docCopied = docSrc.copyToDatabase(dbCurrent);

System.out.println("source doc in: " + docSrc.getParentDatabase().getReplicaID() );
System.out.println("target doc in: " + docCopied.getParentDatabase().getReplicaID() );
paulswithers commented 8 years ago

I believe copyToDatabase() is less performant that .createDocument() and .copyAllItems(). As a workaround, I'd recommend using the latter format and, unless anyone knows to the contrary, I suggest we change the code to do this anyway.