-->
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: Criteria query returning list of null pointers
PostPosted: Fri May 13, 2005 1:02 pm 
Newbie

Joined: Fri May 13, 2005 12:52 pm
Posts: 2
I seem to have a Problem with the Criteria-API...

I have mapped a simple class to a table and try to select it via the Criteria-API:

Code:
List users = DBSess.createCriteria(UserBean.class).add(Restrictions.eq("username", uname)).list();


The list I receive does contain the correct number of entries, but every single one of them is null.

I've put together a simple test to use from the command line that demonstrates the Problem and uploaded it to: http://satansoft.de/hibernate/hibernate.tgz

I did search google and these forums but to no avail - maybe I didn't use the right keywords?

thanks in advance

nsn


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 3:23 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Looking at your data you have "id" defined as your PK yet you don't populate that field in your insert statements.

Hibernate will return NULL if any part of your PK is NULL.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 13, 2005 3:25 pm 
Newbie

Joined: Fri May 13, 2005 12:52 pm
Posts: 2
VampBoy wrote:
Looking at your data you have "id" defined as your PK yet you don't populate that field in your insert statements.

Hibernate will return NULL if any part of your PK is NULL.


/me <-- idiot

thank you very much, you saved my day...


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.