[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4916) Literal with JDBC escape syntax for date doesn't work

Steve Ebersole (JIRA) noreply at atlassian.com
Sat Feb 13 12:07:29 EST 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-4916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=35556#action_35556 ] 

Steve Ebersole commented on HHH-4916:
-------------------------------------

How does this work in your JDBC driver?  PreparedStatement.setString( 1, "{d '2001-01-31'}" ) against an expected date is really valid?  My understanding is that JDBC  escape syntax is only valid within the query string.

> Literal with JDBC escape syntax for date doesn't work
> -----------------------------------------------------
>
>                 Key: HHH-4916
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4916
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: entity-manager
>    Affects Versions: 3.5.0-CR-1
>            Reporter: Juergen Zimmermann
>
> I'm having an entity with a java.util.Date attribute:
> @Entity
> public class Kunde implements Serializable {
> 	@Temporal(DATE)
> 	private Date seit;
> 	...
> }
> The following named query crashes, when a Date literal is used for parameter instantiation:
> SELECT k
> FROM  Kunde k 
> WHERE k.seit = :seit
> Here is the stacktrace:
> java.lang.IllegalArgumentException: Parameter value [{d '2001-01-31'}] was not matching type [java.util.Date]
> 	at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:354)
> 	at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:354)
> 	at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:71)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list