Written by

Question Paul Riker · Oct 17, 2016

Multicolumn Persistent List/Array Property

I have a persistent class where I am logging each CCDA I receive. I want to store all of the providers associated to that CCDA (many to one). In a relational database, I would have a child table with a foreign key to the primary table. I'm guessing the equivalent to Cache would be 

1. Create a custom class (ProviderList) with the properties I want to store.

2. Add the class as a property of my CCDA persistent class.

Property Providers as Array of ProviderList (SQLProjection = "table/column";

Am I on the right track?

Comments

Eduard Lebedyuk · Oct 17, 2016

Generally yes, but here's some thoughts:

  • Use List, instead of Array  whenever possible
  • Specify STORAGEDEFAULT as "array" to project list collection properties as child tables
Property Providers as List of ProviderList(SQLProjection = "table/column", STORAGEDEFAULT = "array");
0
Warlin Garcia · Oct 17, 2016

You're on the right track,  however, depending on your needs, always prefer a relationship over a "plain" array/list. One of the biggest benefits is the referential integrity you get "out of the box". 

0
Eduard Lebedyuk  Oct 17, 2016 to Warlin Garcia

The caveat with relationships is that all of the many objects are loaded or none are. That may present a performance problem if you have a one-many relationship with thousands of rows on the many side.

0
Warlin Garcia  Oct 17, 2016 to Eduard Lebedyuk

Relationships load a "collection" of pointers to the members of the relationship. Objects are loaded to memory only when accessed. Pretty much how Arrays work as well. In essence Arrays and Relationships work the same. Relationships provide the extra referential integrity.

0