Monday, January 28, 2013

java hibernate nullable integer fields


To be able to use a nullable integer field with hibernate code generation hbm2java, you just have to change the type since java 1.5 to the java.lang.Integer class.

Before:
<property name="weightInGramm" type="int"/>


After:
<property name="weightInGramm" type="java.lang.Integer" not-null="false"/>


No comments:

Post a Comment