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: ObjectDataSource and partly update
PostPosted: Sat Feb 09, 2008 11:45 am 
Newbie

Joined: Wed Sep 22, 2004 6:21 am
Posts: 3
Hi,
Is any one solved the problem of partly field update in ObjectDataSource?

The ObjectDataSource is updating only the visible fields in the attached GridView and therfore when updating the hibernate object, the other fields are null or default values.

is the only way to solve this is to load the object again based on the object key before update and then copy the newly fields to the loaded object just befor the ObjectDataSource is updating the object?

Thanks,
Noam


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 09, 2008 5:53 pm 
Regular
Regular

Joined: Tue Dec 02, 2003 6:25 pm
Posts: 61
Location: Dallas, TX
I've never been able to do it any other way. NH usually sends SQL to update all columns of a mapped entity. In that case, the convenient way to do it with ODS would probably be to use ISession.SaveOrUpdateCopy(), but it will result in a SELECT before doing an UPDATE.

I presume you've already read: http://www.hibernate.org/hib_docs/nhibe ... g-detached

I don't have any experience with it, but it is possible to configure NH to only update the *changed* properties of an entity. They generally don't advise it because it requires more on-the-fly SQL generation that could degrade performance. However, it may be possible to enable that, associate a "default" version of the object with the session (as described in http://www.hibernate.org/hib_docs/nhibe ... pdate-lock), and then perhaps ISession.Update would result in only updating the changed columns.

Again, I haven't tried it, but would be interested to know whether it would work.


Top
 Profile  
 
 Post subject: Any other ORM solve this problem
PostPosted: Sat Feb 09, 2008 10:07 pm 
Newbie

Joined: Wed Sep 22, 2004 6:21 am
Posts: 3
Thanks for the info, it sometimes good to know you dont have a solution atlist i can stop searching :).

do you know if any other ORM solved the problem?

Thanks,
Noam


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.