-->
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: Update not null fields
PostPosted: Wed Jun 09, 2010 5:13 pm 
Newbie

Joined: Wed Jun 09, 2010 5:08 pm
Posts: 3
Hello,

I have a problem with the update of an entity.

Let's say i have a db with columns

id | content | date

and an entity Question with fields id, content, date

I have the annotation @org.hibernate.annotations.Entity(selectBeforeUpdate = true, dynamicUpdate = true)
When i populate my entity, let's say that date is null, but in db it has already a value, this being an update. Is there a way that hibernate could update only the content field and see that my date is null and not set the null value in db?

Thx in advanced.


Top
 Profile  
 
 Post subject: Re: Update not null fields
PostPosted: Thu Jun 10, 2010 5:45 am 
Beginner
Beginner

Joined: Wed Jul 01, 2009 8:11 am
Posts: 34
i don't think this is possible. i think the question is, why is your date field null if it already has a value in the database? Hibernate tries to represent the objects in the Java world in the database. if you date is null in the Java world, Hibernate will transer this state in the database world. you should take care of your entity having the correct values.


Top
 Profile  
 
 Post subject: Re: Update not null fields
PostPosted: Thu Jun 10, 2010 4:09 pm 
Newbie

Joined: Wed Jun 09, 2010 5:08 pm
Posts: 3
I am using GWT-EXt as my frontend fmw. I am making an edit into a grid panel. So i don't pass to my server all the values from that grid (one being date). So when i populate my entity the date field is null. I was searching for a solution to bypass this problem without making a select before update.


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.