Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 94713 invoked from network); 5 Jun 2009 15:33:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jun 2009 15:33:40 -0000 Received: (qmail 87351 invoked by uid 500); 5 Jun 2009 15:33:52 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 87293 invoked by uid 500); 5 Jun 2009 15:33:52 -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 87283 invoked by uid 99); 5 Jun 2009 15:33:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2009 15:33:52 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists+1214986160035-208411@n2.nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2009 15:33:40 +0000 Received: from tervel.nabble.com ([192.168.236.150]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1MCbPz-00022X-4i for users@openjpa.apache.org; Fri, 05 Jun 2009 08:33:19 -0700 Message-ID: <1244215999139-3031038.post@n2.nabble.com> Date: Fri, 5 Jun 2009 08:33:19 -0700 (PDT) From: Pinaki Poddar To: users@openjpa.apache.org Subject: Re: Code organization In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: ppoddar@apache.org References: X-Virus-Checked: Checked by ClamAV on apache.org Hi Daryl, This is one feature, for a long time, I am interested to be included in JPA or at least in OpenJPA. Having your queries *only* in the major compilation unit is a poor idea for usability point of view and takes away much of the power from tuning a query a posteriori. However, I had considered the facility slightly differently than yours. The primary feature that I considered important in this aspect is to dissociate my queries from the major compilation units. The compilation units will only refer them by name. How about the following and in code Query q = em.createQuery("ANameThatAppearsInNamedQueryRegsitry"); Daryl Stultz wrote: > > Hello, > > I'm frustrated by the fact that I need to define @NamedQuery and others > inside my entity classes. I would like to put what I consider "logic" > where > I think it's appropriate which is often not with the model. Is there a way > to programmatically define Named Queries Sql Result Set Mappings, etc and > register them with the persistence engine? I.e. is there any alternative > to > using annotations/xml for defining these things? > > String query = "select o..."; > NamedQuery nq = new NamedQuery(query); > Persistence.registerNamedQuery(nq); > > Thanks. > > -- > Daryl Stultz > _____________________________________ > 6 Degrees Software and Consulting, Inc. > http://www.6degrees.com > mailto:daryl@6degrees.com > > ----- Pinaki Poddar http://ppoddar.blogspot.com/ http://www.linkedin.com/in/pinakipoddar OpenJPA PMC Member/Committer JPA Expert Group Member -- View this message in context: http://n2.nabble.com/Code-organization-tp3030386p3031038.html Sent from the OpenJPA Users mailing list archive at Nabble.com.