Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 54345 invoked from network); 10 Jan 2007 10:40:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jan 2007 10:40:02 -0000 Received: (qmail 28016 invoked by uid 500); 10 Jan 2007 10:40:07 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 27957 invoked by uid 500); 10 Jan 2007 10:40:07 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 27605 invoked by uid 99); 10 Jan 2007 10:40:05 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=FORGED_HOTMAIL_RCVD2,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: domain of lists@nabble.com designates 72.21.53.35 as permitted sender) Received: from [72.21.53.35] (HELO talk.nabble.com) (72.21.53.35) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jan 2007 02:40:01 -0800 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1H4arm-0001eZ-8h for open-jpa-dev@incubator.apache.org; Wed, 10 Jan 2007 02:39:34 -0800 Message-ID: <8255331.post@talk.nabble.com> Date: Wed, 10 Jan 2007 02:39:34 -0800 (PST) From: wanyna To: open-jpa-dev@incubator.apache.org Subject: Re: How to write it in JPQL In-Reply-To: <2540A260-4A9A-40C3-B982-383F9C19B19C@apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: wanyna@hotmail.com References: <8253611.post@talk.nabble.com> <2540A260-4A9A-40C3-B982-383F9C19B19C@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org There are two tables A and B, I need to execute sql like "insert into A select ... from B". I use JPQL Constructor Expressions, select new A(...) from B, got A list then persist. But some data of A depends on program context, not from B, for simple example: select new A(B.column1, 'xxx') from B, select new A(null, B.column2) from B, select new A(variable, B.column2) from B I have to get the result object[] list and constuct A in my code now. I hope JPQL Constructor Expressions became more powerful, my code will be more simple then. Marc Prud wrote: > > > On Jan 10, 2007, at 12:12 AM, wanyna wrote: > >> >> Hi all. >> I have two questions: >> 1. >> Here is my sql string: >> select 'xxx', TABLE_A.column1 from TABLE_A; >> there is a string 'xxx' as a constant value, >> how to translate it to JPQL? > > I don't think it is possible. Why would you need to do that? > >> 2. >> Another sql used under oracle: >> select TABLE_A.column1 from TABLE_A where rownum<10; >> how to limit range of result in JPQL or jpa? > > Query q = em.createQuery("select ..."); > q.setFirstResult(0); > q.setMaxResults(10); > List results = q.getResultList(); > > > >> -- >> View this message in context: http://www.nabble.com/How-to-write-it- >> in-JPQL-tf2951160.html#a8253611 >> Sent from the open-jpa-dev mailing list archive at Nabble.com. >> > > > -- View this message in context: http://www.nabble.com/How-to-write-it-in-JPQL-tf2951160.html#a8255331 Sent from the open-jpa-dev mailing list archive at Nabble.com.