简体   繁体   中英

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?

Example:

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

Is name nullable?

In your case name is nullable.

Default behaviour is not nullable for primitive types ( int , double , etc) and nullable otherwise.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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