[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2429) SQL Character Types Incorrectly mapped to Java objects

Tyler Van Gorder (JIRA) noreply at atlassian.com
Fri Feb 16 14:56:48 EST 2007


SQL Character Types Incorrectly mapped to Java objects
------------------------------------------------------

         Key: HHH-2429
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2429
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.1    
 Environment: Hibernate 3.2.1, Oracle10g


    Reporter: Tyler Van Gorder


We have a work flow that allows the user to enter an arbitrary SQL statement to be executed by our application. We pass those queries through session.createSQLQuery().


We ran into a problem with String literals, which are reported by Oracle (ResultSetMetaData) to be CHAR. Reading the JDBC API, CHAR is a fixed length string. Hibernate is incorrectly mapping this to a Character field. We ended up overriding the Oracle dialect with our own as follows:

In our constructor, for a dialect that extends Oracle9iDialect:

                super()
		registerColumnType(Types.CHAR, "char($l)" );
		registerHibernateType( Types.CHAR, Hibernate.STRING.getName() );


The HibernateType is the crucial one and we are overriding the behavior in the base "Dialect" class, so this appears that it would be a problem for all database variants that don't explicitly change this.

Thanks.



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