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

Strong Liu (JIRA) noreply at atlassian.com
Thu Oct 13 06:10:19 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2429?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Strong Liu resolved HHH-2429.
-----------------------------

    Resolution: Duplicate
      Assignee: Strong Liu

duplicated by HHH-2304

> SQL Character Types Incorrectly mapped to Java objects
> ------------------------------------------------------
>
>                 Key: HHH-2429
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2429
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.1
>         Environment: Hibernate 3.2.1, Oracle10g
>            Reporter: Tyler Van Gorder
>            Assignee: Strong Liu
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list