Posted by
jtuchel on
Mar 26, 2021; 2:34pm
URL: https://forum.world.st/Possible-FilteredTypeResolver-for-some-classes-in-Hierarchy-tp5128066p5128069.html
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:
[hidden email]
Fliederweg 1
http://www.objektfabrik.deD-71640 Ludwigsburg
http://joachimtuchel.wordpress.comTelefon: +49 7141 56 10 86 0 Fax: +49 7141 56 10 86 1
--
You received this message because you are subscribed to the Google Groups "glorp-group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To view this discussion on the web visit
https://groups.google.com/d/msgid/glorp-group/bb3017f8-2fe3-7233-1aea-51036d6846de%40objektfabrik.de.