Here's my code:
@Override
public void updateUser(String instance, String storeName, final String userId,
final String newUsername, final String newPassword) {
if (storeName == null || storeName == null) {
return;
}
final PersistentEntityStore entityStore = PersistentEntityStores.newInstance(xodusRoot + instance);
entityStore.executeInTransaction(new StoreTransactionalExecutable() {
@Override
public void execute(@NotNull final StoreTransaction txn) {
EntityId roleEntityId = txn.toEntityId(userId);
final Entity entity = txn.getEntity(roleEntityId);
if(newUsername != null) {
entity.setProperty("username", newUsername);
}
if(newPassword != null) {
entity.setProperty("password", newPassword);
}
//txn.commit();
}
});
entityStore.close();
}
I want to know if for this code, is txn.commit();
required so the transaction to be executed, how about for rollback?
ps.
I wanted this code to return boolean if all transaction completed successfully but cannot find way except for txn.commit
which returns boolean, is that the way? So it must be required?