• 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
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Cascading update problem

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am doing some little tests to understand some of the behaviour of hibernate (v3.1) and would like some advice.

I have a bidirection parent child relationship as follows:

parent.hbm.xml




child.hbm.xml




Parent.java




I open a session and get a parent from the database and any chilren are eagerly fetched (ignore the fact that i am eagerly loading a collection this is for a test only). Session closed.

I then create a new child and add it to the parent. Then, in a new Session, update the parent object, resulting in the transient child being persisted. All well and good.

The behaviour i am also seeing is that hibernate is updating all the children even though their state has not changed.

I understand that instead of updating the parent i could save the child and this would prevent the other children being updated. What i would like to know is their a way of configuring hibernate or the relationship so that i can update the parent and persist new children without hibernate firing updates on all the other children.

Any help would be greatly appreciated.

Thanks
John
 
Whoever got anywhere by being normal? Just ask this exceptional tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic