• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate: Updateing many-to-one relation

 
Sverre Moe
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class mapping with a many-to-one relation where the many-to-one does not get updated.

The class mapping is Customer and many-to-one related to Address. Address has its own mapping file too.

When I retrieve Customer from database the Address also gets retrieved and stored into the Customer object.

However. When I try to update it only updates Customer and not Address. I have tried update="true" with no success on the many-to-one relation.

Anyone have an idea of how to fix this?

Edit: I solved the problem by adding insert="true" update="true" cascade="save-update". Then updating the address in customer would also update the Address table
[ January 10, 2008: Message edited by: Sverre Moe ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic