Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 49312 invoked from network); 16 Jan 2008 17:25:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Jan 2008 17:25:40 -0000 Received: (qmail 65602 invoked by uid 500); 16 Jan 2008 17:25:29 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 65578 invoked by uid 500); 16 Jan 2008 17:25:29 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 65428 invoked by uid 99); 16 Jan 2008 17:25:28 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jan 2008 09:25:28 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of saintx.opensource@gmail.com designates 72.14.204.236 as permitted sender) Received: from [72.14.204.236] (HELO qb-out-0506.google.com) (72.14.204.236) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jan 2008 17:25:02 +0000 Received: by qb-out-0506.google.com with SMTP id p36so391728qba.13 for ; Wed, 16 Jan 2008 09:25:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=+fGTBEBDP5BT/l6c2dFjvTzLThvtsgMUuipMpxpPdtI=; b=GkXXY1tde9u4yEzKq0APF7prR1M7aJ2J/PYVILDcBB1SXTAmFpmAce64nkXGpS49CqbsOVs/y/HuAilR8h9x4qdkjPuOAgr58ZnkI0wxPPaykp6FZumTe8y0OxjRYqrUUM6KC0AJguIRFV2BP7fnz39oA6JrqBHBZX+uQkecaaM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=mYOhPkqQKD4ROUzXumkWxHrvDMO4jrEbOGwjJtYKshvL+jgL0mFien2yqOxwlmVpSbTcsQ0RJzEZLfQcJc7aCZrTQYTilV8j9aiulkkpwGFJ4tPnB1JvjR9ejheFm5be4NRq3/FpLwe1Q/eE4dwRzniC6R6U9h2Fn/pmFr4ta9U= Received: by 10.65.153.10 with SMTP id f10mr2250916qbo.33.1200504306827; Wed, 16 Jan 2008 09:25:06 -0800 (PST) Received: by 10.65.193.8 with HTTP; Wed, 16 Jan 2008 09:25:06 -0800 (PST) Message-ID: Date: Wed, 16 Jan 2008 11:25:06 -0600 From: "Alexander Saint Croix" To: users@openjpa.apache.org Subject: Re: EntityManger close against the Query and lazy Loading In-Reply-To: <14885514.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4886_21960206.1200504306824" References: <14847417.post@talk.nabble.com> <14885514.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_4886_21960206.1200504306824 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Yep, defining fetch groups could help you here. I have this same behavior in a number of entities with multiple collection-valued references. Here are some links to the doco on this subject which you might find useful: http://openjpa.apache.org/docs/latest/manual/manual.html#ref_guide_fetch http://openjpa.apache.org/docs/latest/manual/manual.html#openjpa.FetchGroups http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_overview_join_fetch http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_hints_fetchplan http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_langref_fetch_joins http://openjpa.apache.org/docs/latest/manual/manual.html#jpa_langref_fetch_joins Cheers, -- Alex On Jan 16, 2008 10:53 AM, SomuReddy wrote: > > Hi Alexander, > > Thanks for your information, but I am not using the any join( LEFT JOIN > FETCH) in query, I am just specifying the relationship like this.. > > @OneToMany(mappedBy = "fireRsrcDO", cascade = CascadeType.PERSIST) > List fireRsrcVerDOList = null; > > by defaullt OneToMany fatch type is "lazy loading", so problem is when i > close the EntityManager after execution of query(Query is executing on > one > of the dataobject where i specified all these relationships) , data is not > fetching. > Can i use the fetch groups here??? > > Thanks, > Somu > > > Alexander Saint Croix-2 wrote: > > > > Hi. > > > > You should look into using the LEFT JOIN FETCH clause in your query, and > > perhaps should also look at whether some of your collection valued > > references can be set to FetchType.EAGER without causing the cascading > to > > spiral out of control and pull down the entire database. A third > solution > > is to look into using Fetch Groups. > > > > HTH, > > -- > > Alexander R. Saint Croix > > (a user, like you) > > > > > > > > > > On Jan 15, 2008 3:05 PM, SomuReddy wrote: > > > >> > >> Hello, > >> > >> I am creating the own EntityManger for each query to execute? is it > >> required to close the EntityManger after execution of the each Query, I > >> have > >> lazy loading(fetch type) on my data objects with some > relationships(like > >> OnetoMany, ManytoOne and ManytoMany), If I close the EntityManger after > >> the > >> Query execution, i couldn't get data thru relationships as it defined > >> fetch > >> type is "Lazy" and EntityManger is no more active. > >> > >> is there any other soultion except changing the fetch type is from lazy > >> to > >> Eager.. or I should not close the EntityManger after query execution, > If > >> I > >> won't close the EntityManager what are the Cons????? > >> when EntityManager instance will be garabage collect???? > >> > >> Any idea on this??? > >> > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/EntityManger-close-against-the-Query-and-lazy-Loading-tp14847417p14847417.html > >> Sent from the OpenJPA Users mailing list archive at Nabble.com. > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/EntityManger-close-against-the-Query-and-lazy-Loading-tp14847417p14885514.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. > > ------=_Part_4886_21960206.1200504306824--