You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Jo...@filternet.nl on 2014/11/20 13:49:31 UTC
Casting in bi-directional relationships?
I have a general object Assessment that I would like to apply to 'targets' of many different Types in the application.
In order to be as generic as possible I have set the class of the target of the Assessment to 'Object' (private Object target;)
Now if I make a collection on an other object that takes Assessments using @Persistent(mappedBy = "target", dependentElement = "true") JDO cannot map to target.
Anybody has a suggestion?
Re: Casting in bi-directional relationships?
Posted by GESCONSULTOR <o....@gesconsultor.com>.
Hi Johan.
One solution would be to have an abstract base class for all those concrete implementations that contains the "mappedBy" field/property and common logic, assuming the possible concrete classes are "limited" and does not have other (not-common) descendants.
We've implemented like that many times.
Another option would be an m-n relationship or a 1-n relationship with a join table (see on the ISIS Eclipse templates those starting with "isjdc").
HTH,
Oscar
> El 20/11/2014, a las 7:49, JohanDoornenbal@filternet.nl escribió:
>
> I have a general object Assessment that I would like to apply to 'targets' of many different Types in the application.
>
>
>
> In order to be as generic as possible I have set the class of the target of the Assessment to 'Object' (private Object target;)
>
> Now if I make a collection on an other object that takes Assessments using @Persistent(mappedBy = "target", dependentElement = "true") JDO cannot map to target.
>
>
>
> Anybody has a suggestion?
>