• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

many-one association

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 162
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic