java - What is the difference between @ManyToOne(optional=false) vs. @Column(nullable=false) -
in jpa, confused when use attribute optional=false
, annotation @column(nullable=false)
. difference?
@column(nullable=false)
instruction generating schema. database column generated off class marked not nullable in actual database.
optional=false
runtime instruction. primary functional thing related lazy loading. can't lazy load non-collection mapped entity unless remember set optional=false (because hibernate doesn't know if there should proxy there or null, unless tell nulls impossible, can generate proxy.)
Comments
Post a Comment