Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate :Usage of inverse attribute on a Collection Property

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I did a One to Many example in Hibernate .
I took a Student Pojo , and a Address POJO .
Assuming the scenario as
(A Student can have many Addresses)



If i use the option as inverse = true on to the Set tag of my Student hbm file , it works fine

But if i dont use this attribute On to the Set tag , it throws an Exception as ConstraintViolationException .

I heard that we use inverse attribute to make it bidirectional .

Please share your ideas why is it happening

(Its only a Unidirectioanl relation between two POJOs only at the Java level )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic