-->
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: Rows Not loaded if fields are null in Criteria Query
PostPosted: Fri Jan 06, 2006 1:22 pm 
Newbie

Joined: Sun Aug 21, 2005 11:36 am
Posts: 6
Hibernate version: 3.0

Hi,

Doing a query by criteria, if some fields in the table are null then the values of the objects are not loaded even though the correct amount of objects is loaded from the db.

Has anyone seen that?

If I fill the null fields in the db, then the objects get loaded completely...

Best Regards,
Jean Safar


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 07, 2006 8:20 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

Hibernate will not insert null into the Database Tables. So ideally i will throw CGLIB warning when you try to retrieve values from the table if it is null. So make the null values in the DB to empty spaces.

I think you have used JDBC to before for inserting the values, So that is the problem. Set all the values to empty in the DB when they are null. Dont use SQL queries manually to the DB from the Code to insert or update then hibernate will complain.

SO USE ONLY HIBERNATE FOR ALL OPERATIONS

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject: null are put by hibernate
PostPosted: Sat Jan 07, 2006 8:33 am 
Newbie

Joined: Sun Aug 21, 2005 11:36 am
Posts: 6
Hi,

Thanx a lot for the answer.

Yet, hibernate is the one that puts the null in the first place.

Also, it should be valid to have sparse rows. Is it possible to override this behavior and if the value is null in a cell to not throw an exception?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jan 07, 2006 8:50 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

Check this out,

http://www.hibernate.org/116.html

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


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.