Skip to content

Commit

Permalink
fix: auto-incremented save or merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ivy-rew committed Oct 25, 2023
1 parent eae14a9 commit 50e6cb8
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,16 @@ private void addSaveAction() {
var save = addEvent();
save.setName("save");
String doSave = """
ivy.persistence.UNIT.merge(out.edit);
""".replaceAll("UNIT", unit);
if (!out.edit.#id is initialized) {
out.edit = ivy.persistence.UNIT.persist(out.edit) as ENTITY;
out.entries.add(out.edit);
} else {
ivy.persistence.UNIT.merge(out.edit);
}
out.edit = null;
"""
.replaceAll("UNIT", unit)
.replaceAll("ENTITY", entity.getName());
save.setOutput(new MappingCode(doSave));
}

Expand Down

0 comments on commit 50e6cb8

Please sign in to comment.