Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 70783 invoked from network); 4 Jun 2010 18:19:25 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Jun 2010 18:19:25 -0000 Received: (qmail 87831 invoked by uid 500); 4 Jun 2010 18:19:25 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 87807 invoked by uid 500); 4 Jun 2010 18:19:25 -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 87799 invoked by uid 99); 4 Jun 2010 18:19:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jun 2010 18:19:25 +0000 X-ASF-Spam-Status: No, hits=-4.1 required=10.0 tests=AWL,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [216.82.253.179] (HELO mail167.messagelabs.com) (216.82.253.179) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jun 2010 18:19:15 +0000 X-VirusChecked: Checked X-Env-Sender: dk068x@att.com X-Msg-Ref: server-5.tower-167.messagelabs.com!1275675532!20004716!1 X-StarScan-Version: 6.2.4; banners=-,-,- X-Originating-IP: [144.160.112.25] Received: (qmail 4738 invoked from network); 4 Jun 2010 18:18:53 -0000 Received: from sbcsmtp3.sbc.com (HELO tlph064.enaf.dadc.sbc.com) (144.160.112.25) by server-5.tower-167.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 4 Jun 2010 18:18:53 -0000 Received: from enaf.dadc.sbc.com (localhost.localdomain [127.0.0.1]) by tlph064.enaf.dadc.sbc.com (8.14.3/8.14.3) with ESMTP id o54IIq0Q003234 for ; Fri, 4 Jun 2010 13:18:52 -0500 Received: from td03xsmtp006.US.Cingular.Net (td03xspare19-new.us.cingular.net [135.179.64.43] (may be forged)) by tlph064.enaf.dadc.sbc.com (8.14.3/8.14.3) with ESMTP id o54IIkoB003018 for ; Fri, 4 Jun 2010 13:18:46 -0500 Received: from bd01xsmtp004.US.Cingular.Net ([135.163.18.45]) by td03xsmtp006.US.Cingular.Net with Microsoft SMTPSVC(6.0.3790.4675); Fri, 4 Jun 2010 13:18:46 -0500 Received: from BD01MSXMB018.US.Cingular.Net ([135.214.27.52]) by bd01xsmtp004.US.Cingular.Net with Microsoft SMTPSVC(6.0.3790.4675); Fri, 4 Jun 2010 11:18:45 -0700 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Need to implement query with NULLIF with OpenJPA 1.2.2 Date: Fri, 4 Jun 2010 11:18:44 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Need to implement query with NULLIF with OpenJPA 1.2.2 Thread-Index: AcsEEl3qY39aOVYxS/Wm/RHUbV7jcQ== From: "KARR, DAVID (ATTSI)" To: X-OriginalArrivalTime: 04 Jun 2010 18:18:45.0216 (UTC) FILETIME=[5E892600:01CB0412] Using OpenJPA 1.2.2 (I can't upgrade). I have to do a query that gets rows where the current date is between a start/end date range, but if either of the "start" or "end" date is null, to instead compare it against a date value in a one-to-one relationship. This seems like a perfect place to use NULLIF. NULLIF is defined in JPA 2.x, but not in 1.x. Unfortunately, due to restrictions in my container, I can't run OpenJPA 2.x (running JPA 2.x in WebLogic 10.3 requires significant surgery that I'm not able to do yet). I know I could use a native query, but I'm hoping that's a last resort. Can you think of any other strategies I could use?