tags:

views:

12

answers:

1

Hi,

What will happen if i declare DB null feild as not null in Mapping file. Or if not specified anything in the Proeprty coulmn but it is an not-null feild in DB?I am confued. please help.

A: 

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.

binil