You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Marc Logemann <li...@logemann.org> on 2010/09/23 11:33:56 UTC

CURRENT_DATE and OpenJPA 2

Hi,

The following query:

Query query = em.createQuery("select count(d) from Order o, IN(o.deliveryAddress) d " +
                "where o.createdYmd = CURRENT_DATE and d.deliveryMode = ?1");

generates the following SQL:

SELECT COUNT(t1.oid) FROM orders t0 INNER JOIN address t1 ON t0.oid = t1.order_oid WHERE (t0.createdymd IS NULL AND t1.deliverymode = ?) [params=?]

Why the where part with "IS NULL" ? Current_date should be applied there shouldnt it?

One minor question: What can i do that OpenJPA logs the params real values instead of "?"   ?

Thanks

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de





Re: CURRENT_DATE and OpenJPA 2

Posted by Michael Dick <mi...@gmail.com>.
Go ahead and file a bug. I don't see any unit tests that use the
CURRENT_DATE keyword. Even if there's something unique about your
environment we can use the JIRA to add a testcase, or documentation.

Regards,
-mike

On Thu, Sep 23, 2010 at 8:47 AM, Marc Logemann <li...@logemann.org> wrote:

> Thx for the property hint. Should i file a bug because of CURRENT_DATE ?
> Cant think that this doesnt work because this would be quite a killer bug
> right? :-)
>
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
>
>
>
>
> Am 23.09.2010 um 15:34 schrieb Michael Dick:
>
> > Hi Marc,
> >
> > I'm not familiar with the current_date function but what you're saying
> > sounds right.
> >
> > To answer your minor question on parameter logging, you need to add the
> > following property to persistence.xml :
> > <property name="openjpa.ConnectionFactoryProperties"
> > value="PrintParameters=true"/>.
> >
> > It's a change from previous versions, due to concerns about logging
> > sensitive data, there's some content in the infocenter at
> >
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_logging_channels
> ,
> > but it's still easy to miss if you're used to the old behavior.
> >
> > Regards,
> > -mike
> >
> > On Thu, Sep 23, 2010 at 4:33 AM, Marc Logemann <li...@logemann.org> wrote:
> >
> >> Hi,
> >>
> >> The following query:
> >>
> >> Query query = em.createQuery("select count(d) from Order o,
> >> IN(o.deliveryAddress) d " +
> >>               "where o.createdYmd = CURRENT_DATE and d.deliveryMode =
> >> ?1");
> >>
> >> generates the following SQL:
> >>
> >> SELECT COUNT(t1.oid) FROM orders t0 INNER JOIN address t1 ON t0.oid =
> >> t1.order_oid WHERE (t0.createdymd IS NULL AND t1.deliverymode = ?)
> >> [params=?]
> >>
> >> Why the where part with "IS NULL" ? Current_date should be applied there
> >> shouldnt it?
> >>
> >> One minor question: What can i do that OpenJPA logs the params real
> values
> >> instead of "?"   ?
> >>
> >> Thanks
> >>
> >> ---
> >> regards
> >> Marc Logemann
> >> http://www.logemann.org
> >> http://www.logentis.de
> >>
> >>
> >>
> >>
> >>
>
>

Re: CURRENT_DATE and OpenJPA 2

Posted by Marc Logemann <li...@logemann.org>.
Thx for the property hint. Should i file a bug because of CURRENT_DATE ? Cant think that this doesnt work because this would be quite a killer bug right? :-)

---
regards
Marc Logemann
http://www.logemann.org
http://www.logentis.de




Am 23.09.2010 um 15:34 schrieb Michael Dick:

> Hi Marc,
> 
> I'm not familiar with the current_date function but what you're saying
> sounds right.
> 
> To answer your minor question on parameter logging, you need to add the
> following property to persistence.xml :
> <property name="openjpa.ConnectionFactoryProperties"
> value="PrintParameters=true"/>.
> 
> It's a change from previous versions, due to concerns about logging
> sensitive data, there's some content in the infocenter at
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_logging_channels,
> but it's still easy to miss if you're used to the old behavior.
> 
> Regards,
> -mike
> 
> On Thu, Sep 23, 2010 at 4:33 AM, Marc Logemann <li...@logemann.org> wrote:
> 
>> Hi,
>> 
>> The following query:
>> 
>> Query query = em.createQuery("select count(d) from Order o,
>> IN(o.deliveryAddress) d " +
>>               "where o.createdYmd = CURRENT_DATE and d.deliveryMode =
>> ?1");
>> 
>> generates the following SQL:
>> 
>> SELECT COUNT(t1.oid) FROM orders t0 INNER JOIN address t1 ON t0.oid =
>> t1.order_oid WHERE (t0.createdymd IS NULL AND t1.deliverymode = ?)
>> [params=?]
>> 
>> Why the where part with "IS NULL" ? Current_date should be applied there
>> shouldnt it?
>> 
>> One minor question: What can i do that OpenJPA logs the params real values
>> instead of "?"   ?
>> 
>> Thanks
>> 
>> ---
>> regards
>> Marc Logemann
>> http://www.logemann.org
>> http://www.logentis.de
>> 
>> 
>> 
>> 
>> 


Re: CURRENT_DATE and OpenJPA 2

Posted by Michael Dick <mi...@gmail.com>.
Hi Marc,

I'm not familiar with the current_date function but what you're saying
sounds right.

To answer your minor question on parameter logging, you need to add the
following property to persistence.xml :
<property name="openjpa.ConnectionFactoryProperties"
value="PrintParameters=true"/>.

It's a change from previous versions, due to concerns about logging
sensitive data, there's some content in the infocenter at
http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_logging_channels,
but it's still easy to miss if you're used to the old behavior.

Regards,
-mike

On Thu, Sep 23, 2010 at 4:33 AM, Marc Logemann <li...@logemann.org> wrote:

> Hi,
>
> The following query:
>
> Query query = em.createQuery("select count(d) from Order o,
> IN(o.deliveryAddress) d " +
>                "where o.createdYmd = CURRENT_DATE and d.deliveryMode =
> ?1");
>
> generates the following SQL:
>
> SELECT COUNT(t1.oid) FROM orders t0 INNER JOIN address t1 ON t0.oid =
> t1.order_oid WHERE (t0.createdymd IS NULL AND t1.deliverymode = ?)
> [params=?]
>
> Why the where part with "IS NULL" ? Current_date should be applied there
> shouldnt it?
>
> One minor question: What can i do that OpenJPA logs the params real values
> instead of "?"   ?
>
> Thanks
>
> ---
> regards
> Marc Logemann
> http://www.logemann.org
> http://www.logentis.de
>
>
>
>
>