-->
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: How to Update only not null columns
PostPosted: Thu Oct 13, 2005 1:14 pm 
Newbie

Joined: Thu Oct 13, 2005 1:09 pm
Posts: 1
Hi,
I have a person table & Person Object. I set data for only some columns along with pk, and using saveOrUpdate method. It is updating all columns with null for fileds with null data.

I just want to update only columns that I set data in Object. if filed is null in object, I don't want that column to be touched in table.

How do I do that, any help?
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 1:27 pm 
Senior
Senior

Joined: Thu Aug 04, 2005 4:54 am
Posts: 153
Location: Birmingham, UK
As you know the PK, load the object, modify the properties you need to and update it.

This seems the simplest solution, rather than your apparant method of creating a new object, setting the PK and some proeprties and trying to update it.


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.