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.  [ 2 posts ] 
Author Message
 Post subject: dirty checking and SQL UPDATE behaviour
PostPosted: Mon Apr 19, 2010 8:00 am 
Newbie

Joined: Fri Apr 09, 2010 5:49 am
Posts: 10
Hi,

is it possible in Hibernate that the automatic dirty checking on entities actually performs an update only on the properties I have changed for real?

for example:

//open transaction, get an entity "Person"
person.setName("name");
person.setSurname("name");
//commit transaction

performs an UPDATE statement like "update PERSON set NAME=?, SURNAME=? WHERE...", that updates only the properties I have changed for real and not all?

in my SQL code generated the update always update all the entities.


Top
 Profile  
 
 Post subject: Re: dirty checking and SQL UPDATE behaviour
PostPosted: Mon Apr 19, 2010 8:58 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
In your mapping file for the Person class you can enable dynamic-update:

Code:
<class name="Person" ... dynamic-update="true" ...>


Or, if you are using annotations:

Code:
@org.hibernate.annotations.Entity(dynamicUpdate = true)
public class Person {...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.