Hi,

One problem solved - one to go.

GO is a group. A group has a collection of members (which is a
superclass of group), and has a collection of all groups that contain
it, and has a reference to RO. 
 RO
   + GO
      + MO
         + MO
         + MO
      + MO
      + MO
   + GO

In retrieving the groups in RO, I need to get only those groups where
GO.groupsThatContainMe.size() == 0.... Ie. Where there are no parent
groups for this one.

How can I specify this using a PB Query in my QueryCustomizer?

Thanks again for all your help,

Robert



> -----Original Message-----
> From: Jakob Braeuchi [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 15 January 2004 7:27 a.m.
> To: OJB Users List
> Subject: Re: Qualified Collection Relationships
> 
> 
> hi robert,
> 
> you can solve this problem by using a QueryCustomizer to add 
> additional criteria 
> to the query generated by ojb.
> 
> hth
> jakob
> 
> Coup, Robert Muir wrote:
> 
> > Hi All,
> > 
> > What I have :
> > Root Object RO has:
> >  - a collection of CO objects specified using 
> <collection-descriptor>
> > 
> > Child Object CO has:
> >  - a collection of CO objects specified using 
> <collection-descriptor>
> >  - a reference to a parent CO (null if the object has no CO parent)
> >  - a reference to the RO
> > 
> > Example...
> > 
> > RO
> >   + CO
> >      + CO
> >         + CO
> >         + CO
> >      + CO
> >      + CO
> >   + CO
> >   + CO
> >   
> > However, when my collection of CO's for the RO is built by OJB on 
> > retrieval, it does something like:
> >    SELECT * FROM co WHERE co.RO_reference = RO.id
> > This returns all the CO objects, but I only want the direct 
> children 
> > such as:
> >    SELECT * FROM co WHERE (co.RO_reference = RO.id) AND 
> (co.CO_parent 
> > =
> > null)
> > 
> > Which I would ideally declare something like:
> > 
> > <collection descriptor name="COTree"
> >     element-class-ref="CO"
> >     auto-retrieve="true"
> >     auto-update="false"
> >     >
> >     <inverse-foreignkey field-ref="RO_reference"/>
> >     <inverse-criteria field-ref="CO_parent" value="null"/> 
> > </collection-descriptor>
> > 
> > I searched the mail archives and came up with some posts 
> saying that 
> > qualified relationships were on the todo list in February 
> 2003... Has 
> > there been any progress since then?
> > 
> > Alternatively, how have other people solved this? Setting 
> > auto-retrieve to false and doing a getCollectionByCriteria() in the 
> > PersistenceBrokerAware afterLookup() method seems like a reasonable 
> > option, but means the business object layer starts to know a little 
> > bit much about the persistence mechanisms...
> > 
> > Thanks for your help,
> > 
> > Robert Coup :)
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > 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]

Reply via email to