openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Vorburger" <>
Subject RE: current_date and persistent date field
Date Tue, 09 Sep 2008 17:49:09 GMT
Hello, Marc and Jeremy, others:

> I've been searching for a means to do something similar with JPQL but
haven't found anything yet

I'm wondering if the "SQL passthrough" extenion, see,-e.g.-functions,-or-spec
56.html, could interest you?

> Can one do this with custom functions in OpenJPA ?

May be one could write your own JDBCFilterListener for a need like this?

It would be nice if this area was better documented...


-----Original Message-----
From: Jeremy Bauer [] 
Sent: jeudi, 4. septembre 2008 21:14
Subject: Re: current_date and persistent date field


It isn't very elegant, but you could try using a native query with a
cast to produce the result.  I was able to get the native query below to
produce only Orders for the current date using DB2. My 'created'
field is defined as a TIMESTAMP, which is similar to the DATETIME

        query="select * from ORDER where CAST(created AS DATE) =

This is, of course, DB specific so it may or may not work for with your
DB (SQL Server?).  I've been searching for a means to do something
similar with JPQL but haven't found anything yet.



 This email and any files transmitted with it are CONFIDENTIAL and intended
  solely for the use of the individual or entity to which they are addressed.
 Any unauthorized copying, disclosure, or distribution of the material within
  this email is strictly forbidden.
 Any views or opinions presented within this e-mail are solely those of the
  author and do not necessarily represent those of Odyssey Financial
Technologies SA unless otherwise specifically stated.
 An electronic message is not binding on its sender. Any message referring to
  a binding engagement must be confirmed in writing and duly signed.
 If you have received this email in error, please notify the sender immediately
  and delete the original.

View raw message