From torque-user-return-7849-apmail-db-torque-user-archive=db.apache.org@db.apache.org Fri Mar 28 08:27:05 2008 Return-Path: Delivered-To: apmail-db-torque-user-archive@www.apache.org Received: (qmail 84548 invoked from network); 28 Mar 2008 08:27:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Mar 2008 08:27:05 -0000 Received: (qmail 95120 invoked by uid 500); 28 Mar 2008 08:27:03 -0000 Delivered-To: apmail-db-torque-user-archive@db.apache.org Received: (qmail 95106 invoked by uid 500); 28 Mar 2008 08:27:03 -0000 Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Users List" Reply-To: "Apache Torque Users List" Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 95095 invoked by uid 99); 28 Mar 2008 08:27:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Mar 2008 01:27:03 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [217.24.207.26] (HELO mail.seitenbau.net) (217.24.207.26) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Mar 2008 08:26:14 +0000 Received: from [192.168.15.18] (helo=www.seitenbau.net) by router.seitenbau.net with esmtp (Exim 4.43) id 1Jf9uw-0008Er-TD for torque-user@db.apache.org; Fri, 28 Mar 2008 09:26:34 +0100 In-Reply-To: Subject: RE: Uppercase column names throwing a null pointer access in addAscendingOrderByColumn() To: "Apache Torque Users List" X-Mailer: Lotus Notes Release 7.0.1 January 17, 2006 Message-ID: From: Thomas Fischer Date: Fri, 28 Mar 2008 09:26:29 +0100 X-MIMETrack: Serialize by Router on www/seitenbau(Release 7.0.1|January 17, 2006) at 28.03.2008 09:26:30 AM MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-Spam-Score: -1.4 (-) X-Spam-Report: -1.4 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Virus-Checked: Checked by ClamAV on apache.org a) Please use the constants defined in the generated Peer classes whereever possible. Using the constants is considered good style. b) I do not remember in detail, but it may be that case preserving policy from schema.xml to db and/or Templates hase changed. Check the constants for column names in the 3.2 generated peer class and the 3.3 generated peer class against each other. Torque uses exact case-sensitive matches to find columns in its internal model, so if you use wrong case, you might run into trouble, indifferent of whether the database is case-independent or not. Thomas "Subadhra Jagannathan" schrieb am 28.03.2008 00:24:39: > Hello all, > > I hope someone can help me/point me to what I am doing wrong. > > If do these query in mySQL query browser -- > > select person.PERSON_ID from person where person.PERSON_ID > 100 > order by person.PERSON_ID asc; > > select person.person_id from person where person.person_id > 100 > order by person.person_id asc; > > both works, so I know my sql is not case sensitive on column names. > > But if I use criteria, among the following functions (below), > testCrit() and testCrit1() both works fine, but the testCrit2() with the > uppercase col name in the addAscendingOrderByColumn() fails with the null > pointer exception. > > This was working in Torque 3.2. Can some one point me what is it that I am > doing wrong? > > Thanks a lot. > Subadhra > > > public void testCrit() throws Exception { > Criteria crit = new Criteria(); > crit.addSelectColumn(PersonPeer.PERSON_ID); > crit.add(PersonPeer.PERSON_ID, 100, Criteria.GREATER_THAN); > crit.addAscendingOrderByColumn(PersonPeer.PERSON_ID); > List list = BasePeer.doSelect(crit); > System.out.println(list.size()); > } > > public void testCrit1() throws Exception { > Criteria crit = new Criteria(); > crit.addSelectColumn("person.person_id"); > crit.add("person.person_id", 100, Criteria.GREATER_THAN); > crit.addAscendingOrderByColumn("person.person_id"); > List list = BasePeer.doSelect(crit); > System.out.println(list.size()); > } > > public void testCrit2() throws Exception { > Criteria crit = new Criteria(); > crit.addSelectColumn("person.person_id"); > crit.add("person.person_id", 100, Criteria.GREATER_THAN); > crit.addAscendingOrderByColumn("person.PERSON_ID"); > List list = BasePeer.doSelect(crit); > System.out.println(list.size()); > } --------------------------------------------------------------------- To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org For additional commands, e-mail: torque-user-help@db.apache.org