Posted by
jtuchel on
Mar 26, 2021; 3:01pm
URL: https://forum.world.st/Possible-FilteredTypeResolver-for-some-classes-in-Hierarchy-tp5128066p5128071.html
So given that I cannot mix or nest the TypeResolvers, I am trying with
individuel tables for the TimedIncidents.
It seems impossibly, however, to formulate an ToManyMapping with a
polymorphic Join (VariableJoin).
Something like this:
Customer>>incidents refences a list of TimedIncidents (meaning instances
of one of the subclasses of TimedIncident) which can be stored in either
the Timd_inc_relative or Timed_inc_Abs table.... So far I could only
successfully use VariableJoins for OneToOneMappings for tables in which
the foreign key is stored.
So each TimedIncident stores the customer_id and when you ask a Customer
for its incidents, it will request both "subtables" for candidates to
add to the result collection...
Ideas?
Am 26.03.21 um 15:34 schrieb
[hidden email]:
> 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/0265f48d-95b7-494f-068e-d232f71553b9%40objektfabrik.de.