Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • 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
Sheriff
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: 662
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.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!