This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

many-one association

 
Akhil Maharaj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All ,

Book is associated with Publisher by many-one asociation

I am attaching Book.java ,Book.hbm.xml , Publisher.java , Publisher.hbm.xml.

Everything works OK. When I want to delete couple of rows in PUBLISHER , I am getting exception as they are referred in BOOK table.

Can anybody share ideas if I want to delete all the BOOK objects when the associated PUBLISHER is deleted ? ( Some thing like cascade=delete).
it might be obvious for some of you....

********** Publisher.java


********** Publisher.java ends here

********** Publisher.hbm.xml starts here


********** Publisher.hbm.xml ends here



************ Book.java starts here

************ Book.java ends here


************ Book.hbm.xml starts here

************ Book.hbm.xml ends here
 
Kuladip Yadav
Ranch Hand
Posts: 162
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Akhil,

You can just add set books into Publisher , like you have added chapters in books.
So add it in your Publisher.java and Publisher.hbm.xml

You will get your required result.
For more information Check This Link

Thanks
- Kuldeep
[ November 11, 2008: Message edited by: Kuldeep Yadav ]
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm also stuck with the same issue of cascade delete,can you guys tell me how you have modified the hbm.xml and relevant java file.?

--
Deepak Lal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic