Written by

Question Pedro Lopes · May 12, 2023

How to file with SQL for CARDINALITY=many

If I had:
________________________________________
Class MN.Student Extends %Persistent
{
Property Name As %String;
________________________________________
Class MN.Course Extends %Persistent
{
Property TeacherName As %String;
Relationship StudentName As MN.Student [ Cardinality = one, Inverse = Name ];
________________________________________

For "Cardinality = one" the SQL line below would be sufficient for archiving
INSERT INTO MN.Course (TeacherName, StudentName) VALUES ('Pierre','3')"

________________________________________

But if I had "Cardinality = many"
Relationship StudentName As MN.Student [ Cardinality = many, Inverse = Name ];

How would the SQL line for archiving look like?

Product version: IRIS 2022.1

Comments

Robert Cemper · Aug 9, 2023

Relationship is an Object concept that has no direct equivalent in SQL to handle it
The "MANY" end is basically just a piece of code (RelationshipObject) to handle it.
By SQL you just can set it indirectly from the "ONE" end as you found yourself.
This is a real Property / Column that has a distinct value that you can touch and set
 

0