Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 87329 invoked from network); 3 Oct 2003 08:45:02 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 3 Oct 2003 08:45:02 -0000 Received: (qmail 65803 invoked by uid 500); 3 Oct 2003 08:44:32 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 65793 invoked by uid 500); 3 Oct 2003 08:44:32 -0000 Mailing-List: contact ojb-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Users List" Reply-To: "OJB Users List" Delivered-To: mailing list ojb-user@db.apache.org Received: (qmail 82452 invoked from network); 2 Oct 2003 09:53:38 -0000 Message-ID: <027501c388c5$284ee5e0$010aa8c0@BILLSRV> From: "LAURENT Stephane" To: "OJB Users List" References: <7198A18C4C103449B7A6271C2D01FA6C3BEC2C@madtelex01.indra.es> <003c01c346fb$03e3c420$6401a8c0@bar> Subject: Re: Queries for M:N collections? Date: Thu, 2 Oct 2003 11:11:25 +0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0272_01C388D5.EB6B3870" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------=_NextPart_000_0272_01C388D5.EB6B3870 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, I'm not sur to understand, but ... you have : Class A { Integer idA; =20 String attribute1_A; String attribute2_A; ... Collection listOfA } if your repository is like this : ... you can getCollection of A where listOfA contain at lesat one element = equal to wantedAInstance : crit.addEqual("listOfA",wantedAInstance); getCollectionbyCriteria(A.class,crit); you can getCollection of A where listOfA contain at lesat one element A = having at least A in his listOfA collection : crit.addEqual("listOfA.listOfA",wantedAInstance); getCollectionbyCriteria(A.class,crit); ... is it your goal ? ----- Original Message -----=20 From: Joe Germuska=20 To: OJB Users List=20 Sent: Thursday, October 02, 2003 12:00 AM Subject: Queries for M:N collections? At 16:44 -0500 10/1/03, Joe Germuska wrote: >I'm dealing with a case where I want to model an M:N relationship=20 >between two objects of the same type. I have a collection=20 >descriptor modeled off of the example for this on the OJB site.=20 >When I go to store, I'm getting a class cast exception... For what it's worth, changing that property to a Collection=20 definitely solved my problem. Which leads me to the real question: I need to construct a Query which selects collections for either=20 direction of this relationship. That is, Given a parent, I need to=20 find all of its children, and given a child, I need to find all of=20 their possible parents. I can probably work this out with a QueryBySQL, but I'm trying to=20 avoid that. I don't see any methods on Criteria to set where I can=20 set something like "property contains some member"... Can anyone=20 advise? Thanks in advance, Joe --=20 Joe Germuska =20 Joe@Germuska.com =20 http://blog.germuska.com =20 "We want beef in dessert if we can get it there." -- Betty Hogan, Director of New Product Development, National=20 Cattlemen's Beef Association --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org For additional commands, e-mail: ojb-user-help@db.apache.org --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.522 / Virus Database: 320 - Release Date: 01/10/2003 ------=_NextPart_000_0272_01C388D5.EB6B3870--