[hibernate-issues] [Hibernate-JIRA] Closed: (HBX-617) Reverse engineering uses hibernate type="int" in hbm.xml instead of "integer" for primary key column
Steve Ebersole (JIRA)
noreply at atlassian.com
Mon Mar 21 13:00:53 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Ebersole closed HBX-617.
------------------------------
Closing stale resolved issues
> Reverse engineering uses hibernate type="int" in hbm.xml instead of "integer" for primary key column
> ----------------------------------------------------------------------------------------------------
>
> Key: HBX-617
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-617
> Project: Hibernate Tools
> Issue Type: Bug
> Affects Versions: 3.1beta4
> Environment: Hibernate 3.0, SQL Server 2000, jtds-1.2 driver
> Reporter: Stefanie Liepmann
> Priority: Minor
> Fix For: 3.1.beta5
>
>
> I have a table in SQL Server 2000 with the following properties:
> Name: Case_ID
> DataType: int
> Length: 4
> Allow Nulls: No
> It is the primary key on the table and it uses the identity generator.
> I created a hibernate.reveng.xml file and edit it in the Hibernate Reverse Engineering Editor.
> The code for the file looks some like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" >
> <hibernate-reverse-engineering>
> <table-filter match-catalog="DBName" match-schema="dbo"
> match-name="Study" />
> <table catalog="DBName" schema="dbo" name="Study">
> <primary-key>
> <generator class="identity"></generator>
> </primary-key>
> <column name="Column2" jdbc-type='' />
> <!-- more columns here -->
> </table>
> </hibernate-reverse-engineering>
> When it generates the hbm.xml file the code looks like this:
> <id name="caseId" type="int">
> <column name="Case_ID" />
> <generator class="identity"></generator>
> </id>
> Therefore when I generate the .java code, the Java datatype is a primitive "int". This is not desired since the primary key column should be an object (java.lang.Integer in this case) and not a primitive. Shouldn't the type in the hbm.xml file default to "integer". I know that I can "fix" this behaviour by mapping the datatypes in the "Type Mappings" tab, but I wonder if this is what is intended and if it will frustrate other users. I also noticed a similar problem with the short datatype in that I had to explicitly use "java.lang.Short" when the column allows nulls. Otherwise the hbm2java did not map it correctly. If I am wrong about this, please let me know.
--
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