Search code examples
javaxodus

CompressBackupUtil does not backup blobs


I have this code

    Environment env = manager.getEnvironment(xodusRoot, appId);
    final File backupFile = CompressBackupUtil.backup(env, new File(env.getLocation(), "backups"), null, true);

    Representation representation = new FileRepresentation(backupFile, MediaType.APPLICATION_ZIP);
    Disposition disposition = new Disposition(Disposition.TYPE_ATTACHMENT);
    disposition.setFilename(backupFile.getName());
    representation.setDisposition(disposition);
    setStatus(Status.SUCCESS_OK);

It works but the problem is that the blobs are not getting into the backup. What could be missing?


Solution

  • The Environments API doesn't allow blobs. To deal with blobs, you have to have an instance of PersistentEntityStore. It is Backupable, as well as Environment is. If you pass the instance of PersistententityStore (instead of Environment) to CompressBackupUtil.backup(...), then you will get backup files with blobs.