I'm trying to remove a version from the version history and I'm getting javax.jcr.ReferentialIntegrityException: Unable to remove version. At least once referenced.
When I try to remove all references to the version it seems like there aren't any and still does not allow me to remove the version. I am sure that this is not the root version and I'm also sure its not the first after the root.
This is my code:
Version ver = manager.checkin(parentNodePath);
VersionHistory versionHistory = manager.getVersionHistory(parentNodePath);
PropertyIterator versionReverences = ver.getReferences();
for (Property verRef = versionReverences.nextProperty(); versionReverences.hasNext();) {
verRef.remove();
}
session.save();
versionHistory.removeVersion(ver.getName());
Any help is greatly appreciated, thanks.