Esteban,
Am 26.03.21 um 13:37 schrieb Esteban Maringolo:
> Hi Joachim,
>
> It's an interesting question.
I know ;-)
> As far as I understand you can't nest type resolvers that way, since
> it's not an arbitrary depth "composite" structure, but instead, there
> is a 1:1 relation between the TypeResolver and the TypeMapping.
Ouch.
> So if you have this hierarchy:
>
> Incident (root horizontal resolver)
> - TimedIncident
> - - RelativelyTimedIncident
> - - AbsolutelyTimedIncident
> - CriticalIncident
> - SelfInflictedIncident
> - ...
Yes, that's what it looks like. And some classes only reference
TimedIncidents and no others.
> You can't query Incident and get the instances of all the subclasses.
In this specific case, this wouldn't be necessary, that variable only
holds TimedIncidents. But of course the ability to get all Incidents is
still needed for other purposes...
> I wonder what it would take to make that work, because resolvers are
> mostly about knowing the tables involved.
So far, I always failed in such experiments with Glorp...
>
> BONUS:
>> How can I define a OneToManyMapping from, say, Customer, to TimedIncident (or better its subclasses)?
>> The customer_id resides in the timed_incident table.
> Without all the above limitations it would be just about doing this:
>
> (aDescriptor newMapping: ToManyMapping)
> attributeName: #incidents;
> referenceClass: TimedIncident;
> join:
> (Join
> from: (table fieldNamed: 'id')
> to: ((self tableNamed: 'timed_incident') fieldNamed: 'customer_id'))
Well, it's a Bonus question, so of course the limitations above apply ;-)
Thanks for answering,
Joachim
--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel mailto:
jtu...@objektfabrik.de
Fliederweg 1
http://www.objektfabrik.de
D-71640 Ludwigsburg
http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1