[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2582) foncusion of DECIMAL and NUMERIC column types in MySQL5

Gerald Loeffler (JIRA) noreply at atlassian.com
Fri Apr 20 11:29:04 EDT 2007


foncusion of DECIMAL and NUMERIC column types in MySQL5
-------------------------------------------------------

                 Key: HHH-2582
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2582
             Project: Hibernate3
          Issue Type: Bug
          Components: core
    Affects Versions: 3.2.0.ga
         Environment: MySQL 5.0.27 InnoDB on windows
            Reporter: Gerald Loeffler


when doing schema validation with

  <property name="dialect">
    org.hibernate.dialect.MySQL5InnoDBDialect</property>
  <property name="hbm2ddl.auto">validate</property>

against a table with a DECIMAL/NUMERIC columns, the hibernate schema validator always reports a column type mismatch, saying that it expected "NUMERIC".

this can be explained as follows:

1. MySQL always reports columns created as NUMERIC or DECIMAL as DECIMAL. i.e.,

  CREATE TABLE `T` (
    `d` decimal(10,0) NULL,
    `n` numeric(10,0) NULL
  )

will create a table where both columns d and n are of dataype DECIMAL.

2. the hibernate MySQL5InnoDBDialect ultimately inherits from MySQLDialect and this registers the following column type:

  registerColumnType(2, "numeric($p,$s)");

which means that when doing schema validation against a column of type DECIMAL hibernate will report a type mismatch.

indeed, if one creates a new hibernate dialect which is identical to MySQL5InnoDBDialect/MySQLDialect  in all respects apart from registering the following column typ

  registerColumnType(2, "decimal($p,$s)");

then the aforementioned schema validation error is not reported, i.e., schema validation succeeds as expected.


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