These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Updated record after an attribute modification
PostPosted: Tue Jun 13, 2006 10:06 am 
Newbie

Joined: Wed Apr 20, 2005 6:05 am
Posts: 9
Howdy,
I am using Hibernate 2.1.8 within weblo.
I have an object A having a "set" relation with an object B. I noticed that when I change only one attribute from my object B, hibernate updates all the attributes of B and not only the one that have been changed. I am wondering if there is a way to oblige hibernate to update only the attribute that have been changed.
best regards.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 13, 2006 4:33 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
You can set the mapping for Object B to use dynamic-update. Something like

Code:
<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="com.starwood.valhalla.poe.marketing.vo">   
   <class name="ObjectBClass" table="Object_B" dynamic-update="true">   
    .....
   </class>


this will generate required update queries for your situation. I dont know if this attribute is also available in version 2.1.8 but you can verify in the DTD.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 14, 2006 4:46 am 
Newbie

Joined: Wed Apr 20, 2005 6:05 am
Posts: 9
ok thanks. It seems that this attribute is present in Hibernate 2. I will try it right away.
thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.