[
https://issues.apache.org/jira/browse/OPENJPA-3066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18139476#comment-18139476
]
ASF subversion and git services commented on OPENJPA-3066:
----------------------------------------------------------
Commit 24795ec9cc7e965ac01ad13dbccbc3f73e2cebf9 in openjpa's branch
refs/heads/master from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=24795ec9c ]
[OPENJPA-3066] Honour TemporalType in setParameter(Parameter, Calendar,
TemporalType) (#272)
* [OPENJPA-3028] Honour TemporalType in setParameter(Parameter, Calendar,
TemporalType)
The Calendar was converted to java.sql.Date/Time/Timestamp and then wrapped
back into a Calendar, so the temporal type was lost. A DATE parameter was
bound with the full time of day as soon as the query ran from the prepared
query cache, which binds parameters without their column.
Keep the Calendar as the value bound to the Parameter<Calendar>, so that
getParameterValue() still returns the caller's Calendar, and remember the
temporal type. The Calendar is converted to the temporal type when the
parameter values are handed to the query for execution, like the int and
String variants do at bind time. Rebinding the parameter without a
temporal type drops it again.
QueryResultCache.pin/unpin/evict(Query) build their cache key from the
values the query is executed with, so they still find the result of a
query whose Calendar parameter is converted to its temporal type.
Fixes TCK
core.query.apitests.Client1#setParameterParameterCalendarTemporalTypeTest
on MySQL, MariaDB and SQL Server, where a DATE column never equals a DATETIME.
* [OPENJPA-3066] Use pattern matching and braces when building the query cache
key
> setParameter(Parameter, Calendar, TemporalType) ignores the TemporalType
> ------------------------------------------------------------------------
>
> Key: OPENJPA-3066
> URL: https://issues.apache.org/jira/browse/OPENJPA-3066
> Project: OpenJPA
> Issue Type: Sub-task
> Reporter: Richard Zowalla
> Assignee: Richard Zowalla
> Priority: Major
> Fix For: 4.2.0
>
>
> The temporal type is lost, so a DATE parameter is bound as a timestamp once
> the query runs from the prepared query cache.
> TCK:
> core.query.apitests.Client1#setParameterParameterCalendarTemporalTypeTest
> fails on MySQL, MariaDB and SQL Server.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)