-->
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.  [ 5 posts ] 
Author Message
 Post subject: how does dynamic-update work?
PostPosted: Tue Dec 20, 2005 7:01 pm 
Regular
Regular

Joined: Thu May 26, 2005 12:20 am
Posts: 72
Hibernate version: 3.0

I am running into a caching problem across different applications that share classes. The most basic solution is to turn caching off or get a cluster aware caching tool. There might be an easier solution for now though that would allow me to continue caching.

The two apps both need write-access to different fields on the class, so I am thinking that by setting dynamic-update = true each of the two apps they will only update the fields that that they each edited. That only works if the way dynmaic-update works is by tracking changes to the object in memory, NOT by doing a compare against the DB.

Is that correct? If a table managed by dynamic-update changes behind-the-scenes, will hibernate update those columns becuase they are different from the database state or will it not update those columns because the object has not changed those fields?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 1:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
It compares with the classes previous in memory value.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 1:59 am 
Regular
Regular

Joined: Thu May 26, 2005 12:20 am
Posts: 72
Thank you david for your response.

That was my understanding from everything that I had read about hibernate, but a simple test case showed that it actually checked the DB first. If I edit the DB table directly and then save the object through Hibernate it overwrites the DB change even if I havent changed that field in memory.

Is there another setting somewhere?

It is correctly doing only some fields in the update. I'll post my test case here in the morning.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 6:20 pm 
Regular
Regular

Joined: Thu May 26, 2005 12:20 am
Posts: 72
I have solved my issue in a much better way, but for the record, it seems like it does not base its check on memory values but rather on DB values. I couldnt put together a scriptable test case, but here is what i did:

1. load object into memory
2. change field A in DB
3. change field B in memory
4. save object
5. field A is not back to the original value loaded from memory.

True story.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 18, 2006 6:21 pm 
Regular
Regular

Joined: Thu May 26, 2005 12:20 am
Posts: 72
excuse me -- it *is* back to the original value from memory.


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