-->
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.  [ 4 posts ] 
Author Message
 Post subject: Why is findDirty's returned value an array?
PostPosted: Fri Dec 19, 2003 6:48 pm 
Newbie

Joined: Sun Nov 30, 2003 4:11 pm
Posts: 11
Hi,

seems like I finally got it... but this does not necessarily means I undestand it :-(

http://forum.hibernate.org/viewtopic.php?p=2182885

Debugging through Hibernate's code, seemed like my object would not be updated, because it was not considerated "dirty enough".

The test I was running is like:
Code:
    IBeneficiario b3 = mgr.newBeneficiario();
    b3.setSolicitud(sol);
    b3.setNumAsegurado(new Integer(3));
    b3.setTelfMovil(new Long(600066066));
    mgr.save(b3);
    mgr.close();

    IPersistenceManager mgr11=Previsora.getManager();
    b2.setTelfMovil(new Long(699065269));
    mgr11.save(b2);
    mgr11.close();


So the field setTelfMovil has been modified, so I would expect hibernate to automagically infere my object was dirty.

To force this, I'm now checking in the findDirty method if the passed object is one of my IBeneficiario implementation's and if so, I will always considere it "dirty".

This does not sound too performance aware to me, and neither too elegant, but it's the only workaround I found so far.
Has anybody else got any better solution?

Also... a doubt... why is Interceptor.findDirty returning an array of ints??
Is it supposed to be kind of a flag/mask to decide which property has been changed? Seems like it's not checked in the calling code, till now?

_
Jorge


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2003 7:32 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
findDirty returns array containing indexes of modified properties.

One of the things this needed for is to support dynamic-update and dynamic-insert (when generated SQL updates/inserts only modified properties)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 19, 2003 7:39 pm 
Expert
Expert

Joined: Tue Sep 16, 2003 4:06 pm
Posts: 318
Location: St. Petersburg, Russia
Since you haven't show your Inteceptor implementation (am I right assuming you have Interceptor?) I have no idea how it should work, but if you simply return null from find dirty, Hibernate will perform its normal dirty check. And believe me, this check works for Long properties fine.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 21, 2003 1:20 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Sounds like a bug in your Interceptor implementation.


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