简体   繁体   English

休眠列无效

[英]Hibernate column nullness default

For a Hibernate table's column definition, if I don't specify not-null or @NotNull, what does the nullability default to? 对于Hibernate表的列定义,如果我未指定not-null或@NotNull,则可空性默认为什么?

Example: 例:

<class name="Person" table="person">
    <id name="id" column="id" type="long"/>
    <property name="name" column="name" type="string"/>
</class>

Is name nullable? name空吗?

In your case name is nullable. 在您的情况下, name为空。

Default behaviour is not nullable for primitive types ( int , double , etc) and nullable otherwise. 对于原始类型( intdouble等),默认行为不可为null,否则为null。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM