Is there any noticeable difference between
<property name="pwdRetryCount" type="java.lang.Integer">
<column name="pwd_retry_count" />
</property>
and
<property name="pwdRetryCount" type="int">
<column name="pwd_retry_count" />
</property>
They only have noticeable difference when handling null value.
It is because int is the primitive data type that cannot assign null to it while java.lang.Integer is the wrapper class of int which can accept null .
So , if pwd_retry_count column is nullable and you use int to map your entity object , for the record which pwd_retry_count is null , error occurs as int cannot store null.
The answer above is totally correct and I just type extra info.
Use nullable types (boxed primitive types like Integer, Double, etc.) for optional values. It depends on your model if it make sense for particular value to be optional. If it has to have default values, you can create @PreX callbacks (for example @PreLoad) or override getter for returning primitive type with default value instead.
Use primitive types for required value. It has some great benefits if you distinguish among these two approaches like:
There is one interesting thing tho. If you use Lombok library and like to use @Getter and @Setter on entities and you control SelectBeforeInsert behaviour with Persistable interface then you should always use big boxed type like Integer, because you canout do genericity with primitive type like Persistable. If you use Persistable + lombok's @Getter + your ID is named like "id" then you have implicit override getter method for getId. It is just symbiose among lombok + jpa entity.