-->
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.  [ 1 post ] 
Author Message
 Post subject: (Help) Return empty list when use " .list() "
PostPosted: Wed Nov 30, 2011 10:01 am 
Newbie

Joined: Wed Nov 30, 2011 9:45 am
Posts: 1
Hi everyone.

My problem is as follow:

When I query the database by using this ....

//This is to perform range search
public List<User> searchIdRange(String userid_from, String userid_to)
{
List<User> userInfo = new ArrayList<User>();

userInfo = currentSession().createQuery("from User usertable where usertable.userid >= ?
AND usertable.userid <= ?").setParameter(0, userid_from).setParameter(1, userid_to).list();

return userInfo ;
}

At database,
userid username
1 NameA
2 NameB
4 NameC
5 NameD

If I pass 1 as userid_from and 2 as the userid_to, hibernate return successfully the the list with 2 records.

However, if I pass 1 as userid_from and 5 as the userid_to, hibernate return empty list to me.

It should return 4 records of list, what is the reason of it?

This problem almost ruin my life!!
Does anyone know the answer!!!?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.