Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 34794 invoked from network); 14 Jan 2005 20:49:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 14 Jan 2005 20:49:45 -0000 Received: (qmail 51833 invoked by uid 500); 14 Jan 2005 20:49:45 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 51633 invoked by uid 500); 14 Jan 2005 20:49:44 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 51620 invoked by uid 500); 14 Jan 2005 20:49:44 -0000 Received: (qmail 51616 invoked by uid 99); 14 Jan 2005 20:49:44 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 14 Jan 2005 12:49:43 -0800 Received: (qmail 34738 invoked by uid 1513); 14 Jan 2005 20:49:42 -0000 Date: 14 Jan 2005 20:49:42 -0000 Message-ID: <20050114204942.34737.qmail@minotaur.apache.org> From: brj@apache.org To: db-ojb-cvs@apache.org Subject: cvs commit: db-ojb/src/test/org/apache/ojb/broker QueryTest.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N brj 2005/01/14 12:49:42 Modified: src/test/org/apache/ojb/broker Tag: OJB_1_0_RELEASE QueryTest.java Log: added testcase for attributes in expressions (price + 1.0) Revision Changes Path No revision No revision 1.61.2.8 +21 -0 db-ojb/src/test/org/apache/ojb/broker/QueryTest.java Index: QueryTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/QueryTest.java,v retrieving revision 1.61.2.7 retrieving revision 1.61.2.8 diff -u -r1.61.2.7 -r1.61.2.8 --- QueryTest.java 12 Dec 2004 01:35:12 -0000 1.61.2.7 +++ QueryTest.java 14 Jan 2005 20:49:41 -0000 1.61.2.8 @@ -11,6 +11,7 @@ import java.util.Vector; import org.apache.commons.lang.time.StopWatch; +import org.apache.ojb.broker.accesslayer.sql.SqlGenerator; import org.apache.ojb.broker.metadata.ClassDescriptor; import org.apache.ojb.broker.platforms.PlatformHsqldbImpl; import org.apache.ojb.broker.query.Criteria; @@ -1542,6 +1543,26 @@ // Groups: 3 Books , 1 Dairy Product assertEquals("check size", list.size(), 2); } + + /** + * ReportQuery with Expression in column need to add table alias to the field (price) + **/ + public void testReportQueryExpressionInStatement() + { + // TODO: make path expressions extent aware + if(ojbSkipKnownIssueProblem("Resolve attributes of expressions")) return; + + Criteria crit = new Criteria(); + ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit); + q.setAttributes(new String[]{"articleId", "price + 0"}); + ClassDescriptor cd = broker.getClassDescriptor(q.getBaseClass()); + SqlGenerator sqlg = broker.serviceSqlGenerator(); + String sql = sqlg.getPreparedSelectStatement(q, cd); + + assertTrue("Bad query generated. the 'price' field has not table prefix. SQL Output: " + sql, sql + .equalsIgnoreCase("SELECT A0.Artikel_Nr,A0.PRICE + 0 FROM Artikel A0")); + } + /** * Test pathExpression and Extents --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org