• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate:What is the significance of not null

 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wanted to know what is the significance of not null attribute in mapping file .If present then what happens and if not then what .
Thanks
 
dennis zined
Ranch Hand
Posts: 330
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
required field?
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by dmay chug:
I just wanted to know what is the significance of not null attribute in mapping file .If present then what happens and if not then what .
Thanks


The not-null attribute in the hbm file will be considered when the you are reverse engineering from your hbm file (i.e. creating schema using the hbm files). If the hbm file contains a not-null attribute, then during schema creation through reverse engineering, this constraint will be added on the database column.
 
Arun Kumarr
Ranch Hand
Posts: 661
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another advantage I must say that hibernate null checks your pojo before hitting the database, which happens in-memory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic