You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Brian Latimer <bl...@apcc.aspca.org> on 2006/02/21 23:00:01 UTC
Expected Extent Behavior?
I have an Interface "I"
It has implementing classes A, B, and C
Classes B and C both extend class A and have a super reference to it.
If use the following:
<class-descriptor class="I">
<extent-class class-ref="A" />
</class-descriptor>
when I search via getCollectionByQuery for instances of "I" then I get
back instances of B and C with all their data and no A objects that
duplicate the id's of these objects. (all instances of A are really
either B or C, so this is what I want anyway)
Previously (OJB1.01 and less) I seem to recall getting back both an A
and a B or and A and a C object for each id when I attempted queries of
this sort.
If instead I use:
<class-descriptor class="I">
<extent-class class-ref="C" />
<extent-class class-ref="B" />
</class-descriptor>
then I get null values for all the A class fields in the returned class
B and C objects.
Is this the expected behavior? Should the query be extent aware like this?
I just thought I'd ask for clarification and if this was odd behavior
point it out.
thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Expected Extent Behavior?
Posted by Armin Waibel <ar...@apache.org>.
Hi Brian,
Brian Latimer wrote:
> I have an Interface "I"
>
> It has implementing classes A, B, and C
>
> Classes B and C both extend class A and have a super reference to it.
>
> If use the following:
> <class-descriptor class="I">
> <extent-class class-ref="A" />
> </class-descriptor>
>
> when I search via getCollectionByQuery for instances of "I" then I get
> back instances of B and C with all their data and no A objects that
> duplicate the id's of these objects. (all instances of A are really
> either B or C, so this is what I want anyway)
This is the expected behavior.
Take care not to mix different inheritance strategies (is not
supported). This case (table-per-subclass inheritance + interface
extent) should work.
>
> Previously (OJB1.01 and less) I seem to recall getting back both an A
> and a B or and A and a C object for each id when I attempted queries of
> this sort.
> If instead I use:
> <class-descriptor class="I">
> <extent-class class-ref="C" />
> <extent-class class-ref="B" />
> </class-descriptor>
>
> then I get null values for all the A class fields in the returned class
> B and C objects.
>
>
> Is this the expected behavior? Should the query be extent aware like this?
>
In further OJB versions there was a bug related to the "table per
subclass" inheritance (multiple joined tables bug) which only returns
instances of the base class (see release-notes "known issues" section of
previous versions). Think that the described behavior could be a side
effect of this bug.
regards,
Armin
> I just thought I'd ask for clarification and if this was odd behavior
> point it out.
>
> thanks
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org