-->
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.  [ 6 posts ] 
Author Message
 Post subject: Dirty Checking Algorithm ??
PostPosted: Fri Apr 16, 2004 5:11 am 
Beginner
Beginner

Joined: Thu Feb 26, 2004 6:59 am
Posts: 47
Location: Gurgaon, India
Hello,

This is just a general question for getting more familiar with Hibernate System.

How Hibernate manage for dirty checking?

As in JDO, those people maintains a bitsets with every object and used to set the bit from every mutator method. And before saving, they ask from statemanager for dirty status of any bean, based on this bitset.

Is there any same algorithm in hibernate, or it is handled by some other way?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 16, 2004 5:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No, Hibernate has a more sophisticated approach that works not only for immutable objects, but also for mutable objects like arrays. (JDO dirty checking does not work for arrays.)

Hibernate uses snapshot comparison instead.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 16, 2004 5:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The other advantage of our approach is that it does not require buildtime bytecode manipulation.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 16, 2004 6:40 am 
Regular
Regular

Joined: Wed Mar 03, 2004 9:38 am
Posts: 70
... and the disadvantage being that it doesn't work for detached objects?

OTOH JDO doesn't support detached objects at all, so I guess this is not really a point in favour of JDO. ;-)

Not that I'm complaining, I can't come up with any sane way to do automatic dirty checking for detached objects.

Anyways, I opened a thread about how to do dirty checking for detached objects here: http://forum.hibernate.org/viewtopic.php?t=929910&highlight=


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 16, 2004 7:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually JDO requires that the enhanced classes be serialization-compatible with unenhanced classes, so they can't use this approach for dirty-checking detached objects either.

Though I agree, it is theoretically possible.

And, indeed, if you wrote your own buildtime bytecode enhancer, you could use Hibernate as the persistence engine with this dirty checking strategy! Just implement Interceptor.findDirty() ... easy as pie...

That would be an interesting project for someone ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 16, 2004 9:38 am 
Beginner
Beginner

Joined: Mon Feb 09, 2004 6:49 am
Posts: 21
Hi

Sorry to bug about more JDO stuff, but I'm a student doing a schoolpaper on JDO vs Hibernate, and I get a bit confused about this runtime/buildtime bytecode processing.
I've also posted a question on the JDOCentral forum,


http://www.jdocentral.com/forums/index. ... #entry6269

and David Tinker seems to be of another opinion regarding wich is better of runtime buildtime processing.

Do anyone have any comments on what David and also Patrick Linskey has to say regarding bytecode processing.

regards dag


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