Return-Path: Delivered-To: apmail-db-ojb-user-archive@www.apache.org Received: (qmail 5100 invoked from network); 4 Oct 2003 09:56:11 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 Oct 2003 09:56:11 -0000 Received: (qmail 76774 invoked by uid 500); 4 Oct 2003 09:55:39 -0000 Delivered-To: apmail-db-ojb-user-archive@db.apache.org Received: (qmail 76759 invoked by uid 500); 4 Oct 2003 09:55:39 -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 76745 invoked from network); 4 Oct 2003 09:55:38 -0000 Received: from unknown (HELO florida) (213.68.49.5) by daedalus.apache.org with SMTP; 4 Oct 2003 09:55:38 -0000 Received: from p508ef1cb.dip.t-dialin.net ([80.142.241.203] helo=mail.local.netz) by florida with asmtp (Exim 4.20 #1 (Debian)) id 1A5j8h-0001VH-GG for ; Sat, 04 Oct 2003 11:55:51 +0200 Received: from sigma.local.netz (sigma.local.netz [192.168.1.14]) by mail.local.netz (Postfix on Debian %v) with ESMTP id 7B81F4A31E for ; Sat, 4 Oct 2003 11:55:50 +0200 (CEST) From: Roland Kruggel To: ojb-user@db.apache.org Subject: Re: Queries for M:N collections? Date: Sat, 4 Oct 2003 11:55:49 +0200 User-Agent: KMail/1.5.4 References: <7198A18C4C103449B7A6271C2D01FA6C3BEC2C@madtelex01.indra.es> <027501c388c5$284ee5e0$010aa8c0@BILLSRV> In-Reply-To: <027501c388c5$284ee5e0$010aa8c0@BILLSRV> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310041155.49948.liste@bbf7.de> 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 Am Donnerstag Oktober 2 2003 11:11 schrieb LAURENT Stephane: > Hi, > I'm not sur to understand, but ... > you have : > Class A > { > Integer idA; > String attribute1_A; > String attribute2_A; > .. > Collection listOfA > } > > > if your repository is like this : > > primarykey="true" autoincrement="true"/> name="attribute1_A" column="a1" jdbc-type="VARCHAR"/> > jdbc-type="VARCHAR"/> .. > auto-retrieve="true" auto-update="true" indirection-table="tableA_A"> > > > > > > > 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 ----- > From: Joe Germuska > To: OJB Users List > 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 > >between two objects of the same type. I have a collection > >descriptor modeled off of the example for this on the OJB site. > >When I go to store, I'm getting a class cast exception... > > For what it's worth, changing that property to a Collection > definitely solved my problem. Which leads me to the real question: > > I need to construct a Query which selects collections for either > direction of this relationship. That is, Given a parent, I need to > find all of its children, and given a child, I need to find all of > their possible parents. > > I can probably work this out with a QueryBySQL, but I'm trying to > avoid that. I don't see any methods on Criteria to set where I can > set something like "property contains some member"... Can anyone > advise? > > Thanks in advance, > Joe > > -- > Joe Germuska > Joe@Germuska.com > http://blog.germuska.com > "We want beef in dessert if we can get it there." > -- Betty Hogan, Director of New Product Development, National > 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 cu -- Roland Kruggel mailto: liste@bbf7.de System: AMD 1200Mhz, Debian woody, 2.4.20, KDE 3.1.4 --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org For additional commands, e-mail: ojb-user-help@db.apache.org