Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

@Basic or @Column  RSS feed

 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

What is the actual difference between @Basic.optional() and @Column.nullable()

is same as

So which one to use when?
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
optional refers to the object model, nullable refers to the data model. Normally you would use both, or neither.

optional may be used for object validation, or internal optimizations. nullable is only used for DDL generation.

 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thankyou a lot James
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!