> -----Original Message----- > From: KARR, DAVID (ATTSI) > Sent: Friday, June 04, 2010 11:19 AM > To: [email protected] > Subject: Need to implement query with NULLIF with OpenJPA 1.2.2 > > 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?
Note that I meant "COALESCE", not "NULLIF".
