Bug 1023994 - java.util.Calendar conversion to java.util.Date fails - HHH-8643
Summary: java.util.Calendar conversion to java.util.Date fails - HHH-8643
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Hibernate
Version: 6.1.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: DR2
: EAP 6.3.0
Assignee: Brett Meyer
QA Contact: Zbyněk Roubalík
Russell Dickenson
URL:
Whiteboard:
Keywords:
Depends On:
Blocks: 1024864 1063408
TreeView+ depends on / blocked
 
Reported: 2013-10-28 14:26 UTC by Gary Hu
Modified: 2018-12-03 20:28 UTC (History)
5 users (show)

(edit)
This release of JBoss EAP 6 contains a fix to a bug in the Hibernate component that caused an `IllegalArgumentException` to be thrown when setting a `TemooralType.DATE` or `TemporalType.TIMESTAMP` parameter in a JPA query. The parameter is intended to be able to use a Calendar or a Date value, however this interchangeability did not operate as expected. The issue has now been corrected and the exception no longer presents when using `TemporalType` parameters in queries.
Clone Of:
(edit)
Last Closed: 2014-08-06 14:38:43 UTC


Attachments (Terms of Use)

Description Gary Hu 2013-10-28 14:26:48 UTC
When using java.util.Calendar in a query to retrieve an entity class containing a field of java.util.Date type it throws exceptions:

Caused by: java.lang.IllegalArgumentException: Parameter value [java.util.GregorianCalendar[time=1382561831603,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Chicago",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=235,lastRule=java.util.SimpleTimeZone[id=America/Chicago,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2013,MONTH=9,WEEK_OF_YEAR=43,WEEK_OF_MONTH=4,DAY_OF_MONTH=23,DAY_OF_YEAR=296,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=4,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=57,SECOND=11,MILLISECOND=603,ZONE_OFFSET=-21600000,DST_OFFSET=3600000]] did not match expected type [java.util.Date]
at org.hibernate.ejb.AbstractQueryImpl.validateParameterBinding(AbstractQueryImpl.java:375) [hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:348) [hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:419) [hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:73) [hibernate-entitymanager-4.2.0.SP1-redhat-1.jar:4.2.0.SP1-redhat-1]
at org.jboss.as.jpa.container.QueryNonTxInvocationDetacher.setParameter(QueryNonTxInvocationDetacher.java:142) [jboss-as-jpa-7.2.1.Final-redhat-10.jar:7.2.1.Final-redhat-10]

The same code worked fine in EAP 5 with Hibernate 3.

Please check https://hibernate.atlassian.net/browse/HHH-8643 for all of the details.

Comment 1 Brett Meyer 2013-10-28 14:39:05 UTC
Recommend EAP 6.3.0 -- low priority issue with a simple workaround.

Comment 2 Brett Meyer 2013-10-28 16:52:22 UTC
Pushed upstream and http://git.app.eng.bos.redhat.com/hibernate/hibernate-core.git/log/?h=eap62-updates (in case there is another 6.2 build for some reason).

Comment 3 Jan Martiska 2014-04-16 10:11:37 UTC
Verified with EAP 6.3.0.ER1 / hibernate-entitymanager 4.2.11.Final-redhat-1

Comment 4 sgilda 2014-05-12 19:46:35 UTC
Changed <literal></literal> tags in Doc Text to ticks (`) to fix Bug 1096865


Note You need to log in before you can comment on or make changes to this bug.