[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6313) ClassCastException specifying type="character" in hbm.xml

Martin (JIRA) noreply at atlassian.com
Mon Jun 13 19:15:24 EDT 2011


ClassCastException specifying type="character" in hbm.xml
---------------------------------------------------------

                 Key: HHH-6313
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6313
             Project: Hibernate Core
          Issue Type: Bug
    Affects Versions: 3.6.5, 3.6.4, 3.6.0
         Environment: Hibernate 3.6.5, Oracle 10g
            Reporter: Martin


I have a class containing a field of type java.lang.Character.
I map this to an Oracle char(1 byte) field using an hmb.xml file as follows:

<property name="IntroducedFlag" column="INTRODUCED" type="character" />

At runtime this results in the following exception:

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character
 at org.hibernate.type.descriptor.java.CharacterTypeDescriptor.unwrap(CharacterTypeDescriptor.java:34)
 at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:52)
 at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:91)
 at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:282)
 at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:277)
 at org.hibernate.loader.Loader.bindPositionalParameters(Loader.java:1873)
 at org.hibernate.loader.Loader.bindParameterValues(Loader.java:1844)
 at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1716)
 at org.hibernate.loader.Loader.doQuery(Loader.java:801)
 at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
 at org.hibernate.loader.Loader.doList(Loader.java:2533)
 at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
 at org.hibernate.loader.Loader.list(Loader.java:2271)
 at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
 at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1716)
 at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)


It works fine in Hibernate 3.5.6 but not in 3.6.0 onwards.

Also probably related to this issue:
https://forum.hibernate.org/viewtopic.php?f=1&t=1010175


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