Return-Path: Mailing-List: contact turbine-torque-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list turbine-torque-user@jakarta.apache.org Received: (qmail 22157 invoked by uid 98); 15 Jan 2003 20:23:41 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Received: (qmail 22080 invoked from network); 15 Jan 2003 20:23:38 -0000 Received: from daedalus.apache.org (HELO apache.org) (63.251.56.142) by nagoya.betaversion.org with SMTP; 15 Jan 2003 20:23:38 -0000 Received: (qmail 12267 invoked by uid 500); 15 Jan 2003 20:22:07 -0000 Received: (qmail 12240 invoked from network); 15 Jan 2003 20:22:07 -0000 Received: from unknown (HELO natmail.tfanet.org) (63.122.113.131) by daedalus.apache.org with SMTP; 15 Jan 2003 20:22:07 -0000 Thread-Index: AcK808ccosP99fFoRGmcP+OCFB73gA== Received: from [192.168.2.19] ([192.168.36.85]) by natmail.tfanet.org with Microsoft SMTPSVC(5.0.2195.2966); Wed, 15 Jan 2003 15:22:08 -0500 Subject: Re: problem retrieving foreign collection content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: normal Priority: normal From: "Peter S. Hamlen" To: "Turbine Torque Users List" In-Reply-To: References: Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 15 Jan 2003 15:23:16 -0500 Message-ID: <1042662196.24579.124.camel@chimayblue.tfanet.org> MIME-Version: 1.0 X-OriginalArrivalTime: 15 Jan 2003 20:22:08.0427 (UTC) FILETIME=[C719BFB0:01C2BCD3] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N The "getProjekts" behavior is slightly complicated. If you look at the generated code, you'll see that it does a form of "lazy" loading. Essentially, it only loads the projects if they haven't been loaded already. So you could get your behavior in the following scenario: 1) Create/load a user from the database. 2) Create a criteria that will not return any projekts 3) Call getProjekts(funkyCriteria) - this will return 0 from the database because no projekts meeet the criteria. 4) Call getProjekts() - this will STILL return 0 because projekts have already been loaded. You could also get your behavior by the following: 1) Create/load a user from the database. 2) Call getProjekts() - this will return 0 from the database because no records have been added yet. 3) Create a projekt for the user by setting the UserId for the projekt and save it to the database. 4) Call get Projekts() - it will still return 0 because THE PROJEKTS HAVE ALREADY BEEN LOADED. 5) The workaround for this problem is to call user.addProjekt() BEFORE you save the projekt to the database. addProjekt will add the new projekt to the collection. Hope this helps -Peter On Tue, 2003-01-14 at 15:19, Marc Lustig wrote: > Hi, > > I have a strange behaviour here: > There is one Projekt related to my user. > > user.getProjekts(); returns zero Projekts (WRONG) > > When I replace the line with > user.getProjekts(new Criteria()); > one Projekt is returned (correct). > > I really can't follow what is going on here, as method getProjekts() simply > creates an empty Criteria and passes to getProjekts(Criteria c): > > public List getProjekts() throws TorqueException > { > if (collProjekts == null) > { > collProjekts = getProjekts(new Criteria(10)); > } > return collProjekts; > } > > What's that? > > Marc > > > -- > To unsubscribe, e-mail: > For additional commands, e-mail: >