[hibernate-issues] [Hibernate-JIRA] Created: (HBX-1199) Missing support for n-Types

Haug Bürger (JIRA) noreply at atlassian.com
Mon Mar 19 10:56:48 EDT 2012


Missing support for n-Types
---------------------------

                 Key: HBX-1199
                 URL: https://hibernate.onjira.com/browse/HBX-1199
             Project: Hibernate Tools
          Issue Type: Bug
          Components: reverse-engineer
    Affects Versions: 3.2.cr1
            Reporter: Haug Bürger


org.hibernate.cfg.reveng.JDBCToHibernateTypeHelper
...

    // length is for string column
    public static boolean typeHasLength(int sqlType) {
       return (sqlType == Types.CHAR || sqlType == Types.DATE
             || sqlType == Types.LONGVARCHAR || sqlType == Types.TIME || sqlType == Types.TIMESTAMP
             || sqlType == Types.VARCHAR );
    }

I think the following line is missing:
|| sqlType == Types.NCHAR || sqlType == Types.NVARCHAR || sqlType == Types.NCLOB

I think that this makes the reverse engineer fail to add the length attribute if the column type is nvarchar. If a column is varchar the following xml is generated:
{{<property name="my_column" type="java.lang.String"><column name="MY_COLUMN" length="50" /></property>}}

If a column is nvarchar the following xml is generated:
{{<property name="my_column" type="java.lang.String"><column name="MY_COLUMN" /></property>}}

This is relevant in case you use the length attribute to validate the columns in your application.



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list