Mapping to 1:N's to the same table is fine, heack mapping 1:N's form one class to itself multiple times works fine.

From looking at your configs I will venture that you are using the PB API and one of the collections isn't loading -- try setting auto-retrieve on the collections, or (these are exclusive) try using the ODMG API (which will retrieve them automagically)

-Brian

On Jan 13, 2004, at 7:58 PM, Dirk Manske wrote:

Hi,

how can I map two tables with each having a 1:N relation to the same table?
I always get a null pointer exception for class Person.


I have three tables:

PERSON with a 1:N relation to ACTIVITY

and

VENTURE with a 1:N relation to ACTIVITY

Table PERSON and VENTURE both references activityId from table ACTIVITY. In
the repository-user.xml for each table which relates to ACTIVITY the
collection-descriptor is setup


for table VENTURE:

<collection-descriptor
name="allAssignedActivities"
element-class-ref="de.plato.Activity"
orderBy="activityId"
sort="DESC"
auto-update="true" >
<inverse-foreignkey field-ref="ventureId" />
</collection-descriptor>

and for table PERSON:

<collection-descriptor
name="allAssignedActivities"
element-class-ref="de.plato.Activity"
orderBy="activityId"
sort="DESC"
auto-update="true" >
<inverse-foreignkey field-ref="personId" />
</collection-descriptor>

for ACTIVITY, both tables are referenced:

<reference-descriptor name="person">
class-ref="de.plato.Person"
refresh="true"
auto-retrieve="true">
<foreign-key field-ref="personId" />

and

<reference-descriptor name="venture">
class-ref="de.plato.Venture"
refresh="true"
auto-retrieve="true">
<foreign-key field-ref="ventureId" />

Unfortunately, this does not work. What do I have to do?

thx,
Dirk


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to