Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
2 replies
Subscribers
7 subscribers
Views
1671 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
In the context of Appian, for the One to Many relationship, is there a differenc
samk
over 9 years ago
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
0
Aleksi White
Appian Employee
over 9 years ago
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
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Aleksi White
Appian Employee
over 9 years ago
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
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data