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
6 replies
Subscribers
7 subscribers
Views
3660 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Integrations
What are the best practices for handling RDBMS table relationships. We usually c
sariqs
over 9 years ago
What are the best practices for handling RDBMS table relationships. We usually create CDTs to map with our tables and in case there are multiple tables associated with each other we create nested CDTs.
My questions is more around mapping the inter related tables with nested CDTs using annotations with Lazy loading enabled. As Appian uses hibernate in the backend it should support lazy loading but I have seen whole object graph is fetched in process variables even if nested CDTs are configured as lazy loading enabled. In case lazy loading isn't supported in the process variables what are the best practice to model the nested CDTs in this case ?
Please let me know.
OriginalPostID-161380
OriginalPostID-161380
Discussion posts and replies are publicly visible
0
rajatm
over 9 years ago
If you have nested CDTs, I have seen issues when there is many-to-many relationship beyond 1 level. I prefer to keep the CDTs independent and then add foreign key in the tables to create relationship. Best practices :
forum.appian.com/.../Database_Schema_Best_Practices.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Tim
Certified Lead Developer
over 9 years ago
As you can see from the help pages fetch type is not a supported jpa configuration in Appian
forum.appian.com/.../Custom_Data_Types_from_XSD.html
Some guidelines on database design can be found here in the best practices sections
forum.appian.com/.../Appian_Best_Practices.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
I think it is best to create several CDTs mapped to the same tables tailored to a certain need. E.g. you need to fill a grid with many items but only need data from the main table, you create a flat CDT with only the needed data. For loading a single item you can create a full fledged CDT.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sariqs
over 9 years ago
@tim.clarke I totally missed the fetch type annotation is not listed in supported annotation list.
Right now what we are doing is if object graph is not lengthy than we are using annotations to handle the mapping, in case there are several inter related objects than we handle the mapping ourselves by adding foreign keys as mentioned by @rajat.
Obviously in second case handling mapping manually, its pain in the neck because from database write,read to render the data on UI requires a whole lot of efforts as you need to write everything. Anyway we don't have any other option for it.
@stefan Sorry but I am not in full agreement of creating sub CDT (used to hold subset of all columns in master CDT) you have mentioned or it might be possible that the example is not the best fit here. For the projection on CDT columns we are using queryEntity as it provides more control also its easy to maintain in case we need to add or remove any column based on requirement from queryentity expression rather than modifying the sub CDT itself. Please let me know if I am on wrong track here.
Thanks all for your answers.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Stefan Helzle
A Score Level 3
over 9 years ago
Yes, sure, it depends on how your data is designed etc. It is just one possible way to handle it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 9 years ago
As a general rule, we nest type lookups (eg product has product type nested) but outside of that, other than in some very specific use cases, we try to avoid nesting.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel