What is reason to declare not-null field in hibernate Property tag?
What will happen if I declare DB null field as not null in Mapping file? Or if nothing is specified in the Property column but it is a not-null field in the DB? I am con开发者_如何学Gofused, please help.
The not-null
attribute is useful when the DB schema is generated by Hibernate; the corresponding DB column will be marked NOT NULL
in the table. See the documentation for <property/>
tag.
What will happen if i declare DB null feild as not null in Mapping file.
Nothing will happen in this case.
Or if not specified anything in the Proeprty coulmn but it is an not-null feild in DB?
If your Java code tries to insert an entity with the attribute unspecified, the database (well, at least the good ones) will reject the INSERT
.
精彩评论