lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

Hibernate schema validation failed for decimal/numeric columns #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm doing schema validation with 
<property name="hibernate.dialect">org.hibernate.dialect.H2Dialect</
property>
<property name="hbm2ddl.auto">validate</property>

When i do schema validation against a table with a decimal/numeric column 
the hibernate schema validator always reports a datatype mismatch, saying:
[org.hibernate.HibernateException: Wrong column type in 
STORAGE.PUBLIC.CREDITS for column sum. Found: decimal, expected: numeric]

It seems that H2 use "decimal" for "numeric" type.

Googling for this problem I found that problem in dialect file.

Possible fix:
 change
  registerColumnType(Types.NUMERIC, "numeric");
 to
  registerColumnType(Types.NUMERIC, "decimal($p,$s)");

If this fix is correct. I think it should be added to this bug report:
 http://opensource.atlassian.com/projects/hibernate/browse/HHH-3401

Original issue reported on code.google.com by kua...@gmail.com on 1 Oct 2009 at 5:04

GoogleCodeExporter commented 9 years ago
And what about this issue?

I found HHH-3377 in Hibernate Jira: http://opensource.atlassian.com/projects/
hibernate/browse/HHH-3377 but it seems no reaction (last update 07/Jul/08).

Original comment by kua...@gmail.com on 2 Oct 2009 at 3:41

GoogleCodeExporter commented 9 years ago
Thanks! I will change the Hibernate dialect that is included within H2
(src/tools/org/hibernate/dialect/H2Dialect.java.txt) but unfortunately I can 
not tell
when this will be fixed in Hibernate.

It would be great if you could submit a simple test case (the simpler the 
better)
where the problem can be reproduced. This is mainly for the Hibernate team - it 
will
speed up changing the dialect in Hibernate itself. 

Original comment by thomas.t...@gmail.com on 2 Oct 2009 at 8:45

GoogleCodeExporter commented 9 years ago
Should be fixed in H2 version 1.2.120

Original comment by thomas.t...@gmail.com on 4 Oct 2009 at 2:34

GoogleCodeExporter commented 9 years ago
It looks like I forgot to close this issue.

Original comment by thomas.t...@gmail.com on 8 Nov 2009 at 1:29

GoogleCodeExporter commented 9 years ago

Original comment by thomas.t...@gmail.com on 8 Nov 2009 at 1:30