[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4050) yes_no type is broken

David Galichet (JIRA) noreply at atlassian.com
Wed Jan 13 09:19:29 EST 2010


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

David Galichet commented on HHH-4050:
-------------------------------------

+1,

I've got exactly the same problem using a YesNoType and a spring HibernateTemplate.bulkupdate(sqlStatement, new Object[]{"Y", ...});

[org.hibernate.type.YesNoType] - could not bind value 'Y' to parameter: 1; java.lang.String
java.lang.ClassCastException: java.lang.String
	at org.hibernate.type.CharBooleanType.toCharacter(CharBooleanType.java:44)
        ...

I had to replace the 'Y' by true in order to be able to fix the problem.

Regards,

David.

> yes_no type is broken
> ---------------------
>
>                 Key: HHH-4050
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4050
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.7
>         Environment: Windows XP
> DB2 9.5
> Hibernate 3.2.7
>            Reporter: David J. M. Karlsen
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> The yes_no usertype seems broken.
> Stacktrace:
> Caused by: java.lang.ClassCastException: java.lang.String incompatible with java.lang.Boolean
> 	at org.hibernate.type.CharBooleanType.toCharacter(CharBooleanType.java:44)
> 	at org.hibernate.type.CharBooleanType.set(CharBooleanType.java:35)
> 	at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
> 	at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
> 	at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:44)
> 	at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:491)
> 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1567)
> 	at org.hibernate.loader.Loader.doQuery(Loader.java:673)
> 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
> 	at org.hibernate.loader.Loader.doList(Loader.java:2217)
> 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)
> 	at org.hibernate.loader.Loader.list(Loader.java:2103)
> 	at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
> 	at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:340)
> 	at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
> 	at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1122)
> 	at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
> 	at org.springframework.orm.hibernate3.HibernateTemplate$31.doInHibernate(HibernateTemplate.java:956)
> 	at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
> 	at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
> 	at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedParam(HibernateTemplate.java:947)
> 	
> 	There is a cast to Boolean, but the actual argument is the string.
> 	
> 	Mapping configuration:
> 	<property name="myProperty" type="org.hibernate.type.YesNoType" length="1" column="SDDBA_DEBTOR_ALL_ACCOUNTS_IND" not-null="true" />
> 	
> 	The column is declared as char(1) not null

-- 
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