db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: Bug in 1:n Collection or...?
Date Fri, 09 Jul 2004 06:41:54 GMT
Ok, will do that - I already debugged this a little bit and
for me - without any knowledge about ojb internals - it
looked ok. Except the comparission of the identity objects.
As soon as I have time, I will report back.

Carsten 

> -----Original Message-----
> From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch] 
> Sent: Thursday, July 08, 2004 7:01 PM
> To: OJB Developers List
> Subject: Re: Bug in 1:n Collection or...?
> 
> hi carsten,
> 
> i cannot confirm this behaviour, i was moving the 'parent 
> pointer' field to different locations and it worked ??
> i think you should try tho debug 
> QueryReferenceBroker#retrieveCollection,
> this could help us a lot ;)
> 
> tia
> jakob
> 
> > whoa, good find.
> > 
> > -Brian
> > 
> > On Jul 8, 2004, at 9:49 AM, Carsten Ziegeler wrote:
> > 
> > > Some more interesting things (and this time I think it is 
> a bug :) ):
> > > The order in the class-descriptor is important! If I use:
> > >
> > > <class-descriptor class="B" table="b">
> > >   <field-descriptor name="id" ...>
> > >   <field-descriptor name="refToA" id="7" .../>
> > >   <field-descriptor name="someField"/>
> > >   <reference-descriptor name="a".../> </class-descriptor>
> > >
> > > then the collection from class A containing the bs is empty again!
> > > If I exchange the two fields "refToA" and "someField" it 
> works again 
> > > (partially) and each object of A has exactly one B (not 
> all, but at 
> > > least one :) ).
> > >
> > > WDYT?
> > >
> 
> > > Carsten
> > >
> > >> -----Original Message-----
> > >> From: Carsten Ziegeler [mailto:cziegeler@s-und-n.de]
> > >> Sent: Thursday, July 08, 2004 1:30 PM
> > >> To: ojb-dev@db.apache.org
> > >> Subject: Bug in 1:n Collection or...?
> > >>
> > >> I'm trying to get a simple 1:n relationship working, here is the 
> > >> (stripped) mapping:
> > >>
> > >> <class-descriptor class="A" table="a">
> > >>
> > >>  <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
> > >>                    primarykey="true" autoincrement="true"/>
> > >>
> > >>  <collection-descriptor name="bs"
> > >>                element-class-ref="B"
> > >>                auto-retrieve="true">
> > >>    <inverse-foreignkey field-ref="refToA"/>  
> > >> </collection-descriptor>
> > >>
> > >> </class-descriptor>
> > >>
> > >> <class-descriptor class="B" table="b">
> > >>
> > >>  <field-descriptor name="id" column="ID" jdbc-type="INTEGER"
> > >>                    primarykey="true" autoincrement="true"/>
> > >>
> > >>  <field-descriptor name="refToA" column="reftoa"
> > >>                           jdbc-type="INTEGER"
> > >>                           access="anonymous" />
> > >>
> > >>  <reference-descriptor name="a"
> > >>                           class-ref="A">
> > >>     <foreignkey field-ref="refToA"/>  </reference-descriptor>
> > >>
> > >> </class-descriptor>
> > >>
> > >> When getting all As using a query, the collection of each A 
> > >> containing Bs is always empty. The interesting thing is, that an 
> > >> SQL statement to fetch the Bs is processed and the Bs 
> are loaded. 
> > >> But somehow they are not added to the collection.
> > >>
> > >> The reverse, fetching B works. They have the correct 
> relation set 
> > >> back to an A object.
> > >>
> > >> Now for the interesting part :) If I use:
> > >>    <inverse-foreignkey field-id-ref="7"/>
> > >>
> > >> and give the "refToA" field the id "7" then the 
> collection of A is 
> > >> not empty but contains the first associated B but never all!
> > >>
> > >> So, question is: is this a bug or am I just too stupid and did 
> > >> oversee something?
> > >>
> > >> I tried this with 1.0.0 and the first part with current CVS.
> > >>
> > >> Carsten
> > >>
> > >> Carsten Ziegeler
> > >> Open Source Group, S&N AG
> > >> http://www.s-und-n.de
> > >> http://www.osoco.net/weblogs/rael/
> > >>
> > >>
> > >> 
> -------------------------------------------------------------------
> > >> -- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For 
> > >> additional commands, e-mail: ojb-dev-help@db.apache.org
> > >>
> > >>
> > >
> > >
> > > 
> --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For 
> > > additional commands, e-mail: ojb-dev-help@db.apache.org
> > >
> > >
> > 
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For 
> > additional commands, e-mail: ojb-dev-help@db.apache.org
> > 
> 
> --
> "Sie haben neue Mails!" - Die GMX Toolbar informiert Sie beim Surfen!
> Jetzt aktivieren unter http://www.gmx.net/info
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 


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


Mime
View raw message