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

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Fri Feb 16 15:17:49 EST 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2429?page=comments#action_26147 ] 

Max Rydahl Andersen commented on HHH-2429:
------------------------------------------

we actually need to extend the auto discovery to take length, precision and scale into account when selecting the proper type

> 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

>
> Original Estimate: 15 minutes
>         Remaining: 15 minutes
>
> 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