In the context of Appian, for the One to Many relationship, is there a differenc

In the context of Appian, for the One to Many relationship, is there a difference between using the MERGE and ALL option? Is there a scenario where we use MERGE instead of ALL?

OriginalPostID-172373

OriginalPostID-172373

  Discussion posts and replies are publicly visible

Parents
  • We don't have a rule of thumb for which one to use, it really depends on the design of your tables and what your requirements are. Here is the breakdown of each:

    CascadeType.ALL - all possible cascading operations performed on the source entity are cascaded to the target of the association. This includes {PERSIST, MERGE, REMOVE, REFRESH, DETACH}

    CascadeType.MERGE - if the source entity is merged, the merge is cascaded to the target of the association

    In the context of Appian, ALL will mean that any operations performed on a parent CDT will cascade to ALL of its children.

    MERGE seems to be a safer option. From my understanding, it will make a copy of the original data and modify it with your transaction. It will only commit that transaction if the original data hasn't changed since the copy was made. If a copy is made and modified in your transaction, but the original data changes during that timeframe (possibly due to another process being run at the same time), the merge operation will throw an exception or the transaction with the merge will fail on commit.

    Sources:
    stackoverflow.com/.../what-do-refresh-and-merge-mean-in-terms-of-databases
    java.boot.by/.../ch06.html
Reply
  • We don't have a rule of thumb for which one to use, it really depends on the design of your tables and what your requirements are. Here is the breakdown of each:

    CascadeType.ALL - all possible cascading operations performed on the source entity are cascaded to the target of the association. This includes {PERSIST, MERGE, REMOVE, REFRESH, DETACH}

    CascadeType.MERGE - if the source entity is merged, the merge is cascaded to the target of the association

    In the context of Appian, ALL will mean that any operations performed on a parent CDT will cascade to ALL of its children.

    MERGE seems to be a safer option. From my understanding, it will make a copy of the original data and modify it with your transaction. It will only commit that transaction if the original data hasn't changed since the copy was made. If a copy is made and modified in your transaction, but the original data changes during that timeframe (possibly due to another process being run at the same time), the merge operation will throw an exception or the transaction with the merge will fail on commit.

    Sources:
    stackoverflow.com/.../what-do-refresh-and-merge-mean-in-terms-of-databases
    java.boot.by/.../ch06.html
Children
No Data