[hibernate-issues] [Hibernate-JIRA] Created: (HBX-828) precision/scaling not taken in hbm2hbm in ant env.

kk (JIRA) noreply at atlassian.com
Mon Nov 20 22:34:05 EST 2006


precision/scaling not taken in hbm2hbm in ant env.
--------------------------------------------------

         Key: HBX-828
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-828
     Project: Hibernate Tools
        Type: Bug

  Components: ant  
    Versions: 3.2beta8    
 Environment: MySQL 5+Hibernate 3.2GA+XP Pro SP2
    Reporter: kk


For a simple test case, I found precision and scale aren't taken by Hibernate Tool 3.2 beta 8 with MySQL 5. Here is my test case (pay attention to "test" field),

CREATE TABLE `test` (
`id` int(5) NOT NULL,
`test` smallint(2) default NULL,
`comment` char(1) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

<hibernate-reverse-engineering>
<schema-selection match-table="test"/>
<type-mapping>
<!-- jdbc-type is name fom java.sql.Types -->
<sql-type jdbc-type="CHAR" length="1" hibernate-type="yes_no"/>
<sql-type jdbc-type="SMALLINT" hibernate-type="java.lang.Integer"/>
</type-mapping>
<!--sql-type jdbc-type="SMALLINT" precision="2" scale="0" hibernate-type="java.lang.Integer"/-->
<table name="test">
<primary-key>
<generator class="native"/>
</primary-key>
</table>
</hibernate-reverse-engineering>

Form log file I noticed this difference,

1. Without precision and attribute specified

[hibernatetool] (cfg.JDBCBinder 803 ) Building property id
[hibernatetool] (cfg.JDBCBinder 542 ) Scanning org.hibernate.cfg.reveng.TableIdentifier(test) for <version>/<timestamp> columns.
[hibernatetool] (cfg.JDBCBinder 552 ) No columns reported while scanning for <version>/<timestamp> columns in org.hibernate.cfg.reveng.TableIdentifier(test)
[hibernatetool] (reveng.OverrideRepository 312 ) columnToHibernateTypeName, <type-mapping> found: java.lang.Integer for Table: test column: test
[hibernatetool] (cfg.JDBCBinder 635 ) Sql type mismatch for Table: test column: test between DB and wanted hibernate type. Sql type set to 5(SMALLINT) instead of 4(INTEGER)
[hibernatetool] (cfg.JDBCBinder 803 ) Building property test
[hibernatetool] (reveng.OverrideRepository 312 ) columnToHibernateTypeName, <type-mapping> found: yes_no for Table: test column: comment


2. With precision and attribute specified
[hibernatetool] (cfg.JDBCBinder 803 ) Building property id
[hibernatetool] (cfg.JDBCBinder 542 ) Scanning org.hibernate.cfg.reveng.TableIdentifier(test) for <version>/<timestamp> columns.
[hibernatetool] (cfg.JDBCBinder 552 ) No columns reported while scanning for <version>/<timestamp> columns in org.hibernate.cfg.reveng.TableIdentifier(test)
[hibernatetool] (cfg.JDBCBinder 803 ) Building property test
[hibernatetool] (reveng.OverrideRepository 312 ) columnToHibernateTypeName, <type-mapping> found: yes_no for Table: test column: comment

So I can't convert Short to Integer with desired precision/scalling. Original post is at http://forum.hibernate.org/viewtopic.php?t=967518&sid=d73f6dfc4663f78f27f7c36b7d656922

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