Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiplicity & not-null

 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If in <many-to-one>, not-null=true what does that mean? Foreign key column cannot take null values or can take null values.
My prediction is it can take null values. It is used when 0..1/0..* multiplicity is there

And, if an association is there between A & B with A's multipicity 1..1 and B's multiplicity is 1..* , Then in database(Create statement) or in Hibernate mapping file(B.hbm.xml) how can B's multipicity with A is represented?
And, if B's multiplicity is 0..* How is this represented?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If in <many-to-one>, not-null=true what does that mean? Foreign key column cannot take null values or can take null values.
My prediction is it can take null values. It is used when 0..1/0..* multiplicity is there

No, it s the opposite. You are right the not-null attribute is a direction for the schema creation stuff in Hibernate. not-null == true means the foreign key column cannot be null (i.e. the multiplicity of the relationship os 1..*).
 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul. I was confused because in "Hibernate in action" in chapter 3 while explaining a relationship between Item and Bid. The author marked
not-null=true for 0..* multiplicity. So it should be false right!!! for 0..* multiplicity.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic