Skip to content

Commit

Permalink
Merge pull request #298 from jpos/fix/gl-session-add-account-order
Browse files Browse the repository at this point in the history
GLSession: Set parent before save in GLSession to avoid db update
  • Loading branch information
ar authored Mar 4, 2024
2 parents 9e45e3f + 4f48286 commit 320e409
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/minigl/src/main/java/org/jpos/gl/GLSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,14 @@ public void addAccount (CompositeAccount parent, Account acct, boolean fast)
throw new GLException (sb.toString());
}
acct.setRoot (parent.getRoot());
acct.setParent (parent);
try {
session.save (acct);
session.flush();
} catch (ConstraintViolationException e) {
e.fillInStackTrace();
throw new GLException("Duplicate code", e);
}
acct.setParent (parent);
if (!fast)
parent.getChildren().add (acct);
}
Expand Down

0 comments on commit 320e409

Please sign in to comment.