CDT's

what are the best practices for nested CDTs. Is there any to advantage to use view instead of nested CDTs?

  Discussion posts and replies are publicly visible

Parents
  • Hello Divya,

    I really liked all the posts above.

    I just wanted to add As a little background a reason for that best practice. Appian CDTs/datastore uses the “improved/simplified version” of the JPA. So one of the inheritated problems is that “nested eager relationships” (which for us in Appian is the nested CDT) because part of the simplification is that all CDTs use eager loading, which means when nested and you query the main table it will try to join all the nested CDTs/tables to get your information. So if you have 1 level nested for n amount of fields the query will join the main table + n number of nested Tables(CDTs).

    Imagine if you had multiple nested levels, that can be a huge join and problem, it means time and load to the server. Even that the JPA has certain limit on the joins let’s say 30 joins per query.

    Most of the times when you query a CDT you don’t really need all those joins and all the fields from all the tables, that’s where the views comes to play, on the views you can select each required field and you decide which joins are really required at that particular query
    .
    One common way to see it is you have datastore for tables and one datastore for views. The tables will be to insert/update , and the views to query and display data to the user.

    Hope this helps.

    Jose
Reply
  • Hello Divya,

    I really liked all the posts above.

    I just wanted to add As a little background a reason for that best practice. Appian CDTs/datastore uses the “improved/simplified version” of the JPA. So one of the inheritated problems is that “nested eager relationships” (which for us in Appian is the nested CDT) because part of the simplification is that all CDTs use eager loading, which means when nested and you query the main table it will try to join all the nested CDTs/tables to get your information. So if you have 1 level nested for n amount of fields the query will join the main table + n number of nested Tables(CDTs).

    Imagine if you had multiple nested levels, that can be a huge join and problem, it means time and load to the server. Even that the JPA has certain limit on the joins let’s say 30 joins per query.

    Most of the times when you query a CDT you don’t really need all those joins and all the fields from all the tables, that’s where the views comes to play, on the views you can select each required field and you decide which joins are really required at that particular query
    .
    One common way to see it is you have datastore for tables and one datastore for views. The tables will be to insert/update , and the views to query and display data to the user.

    Hope this helps.

    Jose
Children
No Data