Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/hibernate/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate:java.lang.Integer和int之间有什么区别吗?_Hibernate - Fatal编程技术网

Hibernate:java.lang.Integer和int之间有什么区别吗?

Hibernate:java.lang.Integer和int之间有什么区别吗?,hibernate,Hibernate,两者之间有什么明显的区别吗 <property name="pwdRetryCount" type="java.lang.Integer"> <column name="pwd_retry_count" /> </property> 及 它们只有在处理空值时才有明显的区别 这是因为int是不能为其分配null的原始数据类型,而java.lang.Integer是int的包装类,可以接受null 因此,如果pwd\u retry\u count列可

两者之间有什么明显的区别吗

<property name="pwdRetryCount" type="java.lang.Integer">
    <column name="pwd_retry_count" />
</property>


它们只有在处理空值时才有明显的区别

这是因为
int
是不能为其分配null的原始数据类型,而
java.lang.Integer
int
的包装类,可以接受null


因此,如果
pwd\u retry\u count
列可为null,并且您使用
int
映射实体对象,对于
pwd\u retry\u count
为null的记录,会发生错误,因为
int
无法存储null。

非常有意义。谢谢
<property name="pwdRetryCount" type="int">
    <column name="pwd_retry_count" />
</property>