-Brian
On Jan 15, 2004, at 10:25 AM, Dirk Manske (Service Respond) wrote:
Unfortunately I cannot provide a testcase for this. But in general, after I
stored the activity with pm.store(venture), the second operation
pm.store(person) should automagically update activity and not save it as a
new entry, right? Or will it be only updated, if the activityId is known?
Because I use DB2 with autoincrement for pk's and therefore on the first
store operation I have no id yet. hm. any idea?
Dirk
-----Ursprüngliche Nachricht----- Von: Brian McCallister [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 15. Januar 2004 04:28 An: OJB Users List Betreff: Re: AW: AW: Two 1:N mappings to one table
Hmm, fun one. I suspect you may have run into the weird edge case.
I don't have an immediate answer on this -- need to play and dig.
Anyone else hit this before? Any chance you can create a unit test that
demonstrates the behavior? If so send it to me and I'll check it in and dig
in (or start prodding).
-Brian
On Jan 14, 2004, at 1:21 PM, Dirk Manske (Service Respond) wrote:
Hi Brian,
exactly. Due to copy & paste I assigned a wrong column to the attribute activityId in class Person. But know I experience the problem, that each created activity is stored twice (with different id's). I mean, I know why, I add activity once to the 'person collection' and to the 'venture collection' and do then pm.store(venture) and pm.store(person). I guess I have to follow a different approach?! Say, store first venture, then retrieve activity to store it with person? or how does it work?
thx, Dirk
-----Ursprüngliche Nachricht----- Von: Brian McCallister [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 14. Januar 2004 18:33 An: OJB Users List Betreff: Re: AW: Two 1:N mappings to one table
It sounds like there is actually a problem in the mapping from class -> table where the activityId is listed.
Any chance you could post the full mapping for these classes, along with the database schema?
-Brian
On Jan 14, 2004, at 11:33 AM, Dirk Manske (Service Respond) wrote:
Hi,
yes, i am using pb. Setting auto-retrieve="true" in the collection-descriptor has not the desired effect, I still get the following two strange error messages:
within browser it shows a null pointer execption for Venture when it tried to retrieve all venture objects associated with activity and in the tomcat console I get a SQL Exception for class PERSON, state that activityId is not valid in the context where it is used (db2 database error message).
When I set auto-retrieve="false" for PERSON in the reference-descriptor of class ACTIVITY, the venture objects are retrieved. no error message. everything works fine, except - of course I have no person objects then.
any idea?
Dirk
-----Ursprüngliche Nachricht----- Von: Brian McCallister [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 14. Januar 2004 15:13 An: OJB Users List Betreff: Re: Two 1:N mappings to one table
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]
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- 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]