nested Data types. Cascade Type

I have CDT with several nested data types. is there any way to avoid updating a nested entity in DB? because I should update some nested data types

  Discussion posts and replies are publicly visible

Parents
  • There's a lot of good information on the CDT Relationships page in the docs. In your case, the main section to look at is the section on Cascade. The Cascade type determines whether or not to update child data in nested CDTs when you write to a Data Store Entity.

    • If you use CASCADE=ALL, it will update all data for the parent and child CDTs.
    • If you use CASCADE=REFRESH, it will only update the parent CDT. Based on your question, this seems like what you might want.

    For both of these options, you can change the cascade type by clicking on the foreign key icon in the CDT designer. If you want to make this change to a CDT that is already mapped to the database, you will also need to alter your existing tables to use this new cascade type.

    In general, One-to-One and One-to-Many work well with the CASCADE=ALL (this is also often called Master-Detail). Many-to-One and Many-to-Many usually work better with CASCADE=REFRESH (also called reference behavior).

  • thank you for your answer, but look like REFRESH update child too. We got it from logs. We have nested data type - bank/ And every time when we update parent entity - bank entity is updated too...

  • What kind of relationship are you using? Can you describe a bit more about your use case?

  • Sure. We have main CDT which refers to some other data types. For example one of them:

    -Transfer (main cdt) 

        - beneficiary (nested cdt)  - @ManyToOne(cascade=CascadeType.ALL) 

          - bank (nested cdt) - @ManyToOne(cascade=CascadeType.REFRESH) 

    We need to update a beneficiary when Transfer is updated, but we should not update Bank (it's dictionary). There are a lot of errors when Appian tries to update Bank in logs.  The error reason is a deadlock for the Bank table.

Reply
  • Sure. We have main CDT which refers to some other data types. For example one of them:

    -Transfer (main cdt) 

        - beneficiary (nested cdt)  - @ManyToOne(cascade=CascadeType.ALL) 

          - bank (nested cdt) - @ManyToOne(cascade=CascadeType.REFRESH) 

    We need to update a beneficiary when Transfer is updated, but we should not update Bank (it's dictionary). There are a lot of errors when Appian tries to update Bank in logs.  The error reason is a deadlock for the Bank table.

Children
No Data