-->
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: Excluding null columns from HQL insert and update queries
PostPosted: Wed May 20, 2009 11:13 pm 
Newbie

Joined: Wed May 20, 2009 11:06 pm
Posts: 1
I am using hibernate annotation to map model objects to db columns, is there any configuration settings to exclude null columns from the insert/update hql queries ?

Here is the scenario :
I have the table of user information. Along with user information i am storing user's photo as well ( BLOB). It is not mandatory that always i need to load the photo ( binary data) during update operation. So during update the particular property for the image in the model object will be null. This overrides the database information with null


any possible solution ?

_________________
Varadhan


Top
 Profile  
 
 Post subject: Re: Excluding null columns from HQL insert and update queries
PostPosted: Thu May 21, 2009 12:40 am 
Newbie

Joined: Tue May 19, 2009 11:22 am
Posts: 6
Hi,

Please set the following attributes at class level:

dynamic-insert="true"
dynamic-update="true"

This will ensure that only updated columns are included in the insert, update queries.

In your case, if the image is not loaded, that column will not be part of the hibernate query.

Hope it helps,
-Kadle


Top
 Profile  
 
 Post subject: Re: Excluding null columns from HQL insert and update queries
PostPosted: Thu May 28, 2009 12:22 pm 
Newbie

Joined: Tue May 19, 2009 11:22 am
Posts: 6
Hi Vardhan,

Did this help you?

Please acknowledge.

Thanks in advance,
-Kadle


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.