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 Daniel Perry <d....@netcase.co.uk> on 2006/04/07 11:00:47 UTC

reflexive collections

Is it possible for an object to have a reflexive collection? ie a collection of
itselfs?

Eg, Class person has:

/**
* @ojb.collection element-class-ref="Person"
*                 indirection-table="friends"
*                 foreignkey="personId" remote-foreignkey="friendId"
*                 proxy="true"
*/
private List<Person> friends;

I tried this, but got an error relating to friendId being ambiguous in a query.
 Is this possible?


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: reflexive collections

Posted by Bruno CROS <br...@gmail.com>.
Hi,

Take care about the loading behaviour with auto-retrieve=true on a reflexive
collection.

Without this consideration, then, querying with alias normally will help to
your error.

++



On 4/7/06, Daniel Perry <d....@netcase.co.uk> wrote:
>
> Is it possible for an object to have a reflexive collection? ie a
> collection of
> itselfs?
>
> Eg, Class person has:
>
> /**
> * @ojb.collection element-class-ref="Person"
> *                 indirection-table="friends"
> *                 foreignkey="personId" remote-foreignkey="friendId"
> *                 proxy="true"
> */
> private List<Person> friends;
>
> I tried this, but got an error relating to friendId being ambiguous in a
> query.
> Is this possible?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>