• Post Reply Bookmark Topic Watch Topic
  • New Topic

@Basic or @Column

 
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
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!