Hibernate Tools version: 3.2.0b9
Mapping documents:
Code:
<hibernate-reverse-engineering>
<type-mapping>
<sql-type jdbc-type="DECIMAL" hibernate-type="long" precision="12"
not-null="true">
</sql-type>
<sql-type jdbc-type="DECIMAL" hibernate-type="int" precision="10"
not-null="true">
</sql-type>
<sql-type jdbc-type="DECIMAL" hibernate-type="integer" precision="8"
not-null="true">
</sql-type>
<sql-type jdbc-type="DECIMAL" hibernate-type="java.lang.Integer"
precision="10" not-null="false">
</sql-type>
</type-mapping>
<table-filter match-name=".*"/>
</hibernate-reverse-engineering>
Name and version of the database:Oracle 9
It is absolutely not comprehensible what effect the hibernate-type as in the examples above has on code generation.
For mandatory fields (not-null=true) i had the following results:
Code:
long -> private long doUniqueIdPk;
Code:
integer -> private java.lang.Integer doUniqueIdPk;
Code:
int-> private int doUniqueIdPk;
For nullable fields:
Code:
Long -> private java.lang.Long doUniqueIdPk;
Code:
Integer -> private java.lang.Integer doUniqueIdPk;
The results for nullable fields are IMHO correct.
The results for mandatory field are weird.
long produces java primitive long. That is fine, as you cannot assign null to it. But: is
long the hibernate type or the java primitive?
integer produces java.lang.Integer, which is not wanted, as it is a non-nullable value.
integer is obviously a hibernate type.
int produces primitive int, which is fine for a non-nullable value.
int is the java primitive type.
To me there are two problems in this:
a) for hibernate-type there are two namespaces mixed together, java.lang and Hibernate. I did not find a way to qualify the values in the documentation.
b)
integer should generate a java primitive int for not-null="true".
Furthermore the hibernate-type (Tools) and type (Core) attributes should be documented much better. There should be a table that clearly points out, what results in what.
So long,
Hayo