Hello.
I'm trying to map an instance variable of a class to two differents objects, each one with its own table.
In ObjectA the variable others is a collection of ObjectA or ObjectB.
This is the code for the class models, the descriptors and the tables for the example:
classModelForObjectA: aClassModel
aClassModel addAttribute: #name.
aClassModel addAttribute: #others collectionOf: ? --> Wich is the type of this collection?
classModelForObjectB: aClassModel
aClassModel addAttribute: #name.
descriptorForObjectA: aDescriptor
(aDescriptor new: DirectMapping) from: #name to: (table fieldNamed: 'name').
--> How is the mapping definition for #others?
descriptorForObjectB: aDescriptor
(aDescriptor new: DirectMapping) from: #name to: (table fieldNamed: 'name').
tableForOBJECTS_A: aTable
aTable createFieldNamed: 'name' type: (self platform varChar: 12).
tableForOBJECTS_B: aTable
aTable createFieldNamed: 'name' type: (self platform varChar: 12).
tableForOBJECTS_LINK: aTable
aTable createFieldNamed: 'parent' type: (self platform varChar: 12). --> The parent is always an ObjectA
aTable createFieldNamed: 'child' type: (self platform varChar: 12). --> The child could be an ObjectA or an ObjectB
Could anybody help me with this? Is there another way to make a variable that is a collection that could store two or more kind of objects?
Thanks a lot.
Maximiliano