]
Diego Pires Plentz resolved HHH-2582.
-------------------------------------
Assignee: Diego Pires Plentz
Resolution: Duplicate
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
Assignee: Diego Pires Plentz
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: