我正在使用 objectify 4 写入 HRD 数据存储。在单元测试中一切正常,在开发服务器或生产中运行应用程序。
但是,当我尝试使用 REMOTE API 连接到 devserver 数据存储时,代码启动 XG 事务时会引发错误。在连接远程 API 时,似乎认为 HRD 未启用。这就是我连接的方式...
public static void main(String[] args) {
RemoteApiOptions options = new RemoteApiOptions().server("localhost", 8888).credentials("foo", "bar");
//options = options.
RemoteApiInstaller installer = new RemoteApiInstaller();
StoredUser storedUser = null;
try {
installer.install(options);
ObjectifyInitializer.register();
storedUser = new StoredUserDao().loadStoredUser(<KEY>);
log.info("found user : " + storedUser.getEmail());
// !!! ERROR !!!
new SomeOtherDao().doSomeDataManipulationInTransaction();
} catch (Throwable e) {
e.printStackTrace();
} finally {
ObjectifyFilter.complete();
installer.uninstall();
}
}
当 new SomeOtherDao().doSomeDataManipulationInTransaction() 在多个实体组上启动事务时,我会抛出错误:
仅在 High Replication 应用程序中允许的多个实体组上的事务
我如何告诉远程 api 这是一个 HRD 环境?