[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1961) Schema validation fails with floating point column in Oracle 10g

Daniel Thommes (JIRA) noreply at atlassian.com
Fri Jul 31 05:15:14 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33683#action_33683 ] 

Daniel Thommes commented on HHH-1961:
-------------------------------------

I'm working with Hibernate 3.1rc2 and had the same problem. In this version I found a workaround that might help in later versions also: In the column metadata of my Hibernate mapping I added the information

sql-type="number"

Please be sure to make the type string lowercase (!). The issue results from the following code found in 

org.hibernate.mapping.Table.validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo)

final boolean typesMatch = col.getSqlType(dialect, mapping).startsWith( columnInfo.getTypeName().toLowerCase() )	|| columnInfo.getTypeCode() == col.getSqlTypeCode(mapping);

-> This line converts the type extracted from the JDBC column metadata to lowercase which will result in "NUMBER" being marked as type mismatch.


> Schema validation fails with floating point column in Oracle 10g
> ----------------------------------------------------------------
>
>                 Key: HHH-1961
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1961
>             Project: Hibernate Core
>          Issue Type: Bug
>    Affects Versions: 3.2.0.cr2
>         Environment: 3.2 CR 2, Oracle 10g express edition release 2, Windows XP service pack 2, JDK 1.5.0_06
>            Reporter: Daniel Dyer
>
> I have a table (created automatically by Hibernate) for mapping a double field.  The table creation from Ant works fine but when starting up JBoss with the hibernate.hbm2ddl.auto property set to validate, I get the following exception:
> Caused by: org.hibernate.HibernateException: Wrong column type: percentage, expected: double precision
>         at org.hibernate.mapping.Table.validateColumns(Table.java:219)
>         at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:965)
>         at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
>         at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:296)
>         at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1176)
>         at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:414)
>         at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:575)
>         at org.hibernate.ejb.Ejb3Configuration.createContainerEntityManagerFactory(Ejb3Configuration.java:245)
>         at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:108)
>         at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:260)
>         ... 127 more
> Doing a "desc" on the table reveals that the column is of type FLOAT with a length of 22.
> I think this may be related to issue HHH-1566 or HHH-1008.

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