-->
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.  [ 2 posts ] 
Author Message
 Post subject: Native query returning different result than PhpMyAdmin
PostPosted: Tue Sep 27, 2011 3:41 am 
Newbie

Joined: Tue Sep 27, 2011 3:34 am
Posts: 2
Hi,
I have a strange behavior I can't explain. Here is my java code :

System.out.println(query);
//List list = session.createSQLQuery(query).list();
//System.out.println("list:" + list.size() + " items returned.");
//System.out.println("itemClass:" + itemClass);
List list = session.createSQLQuery(query).addEntity(itemClass).list();
//System.out.println("list:" + list.size() + " items returned.");
ArrayList<T> items = new ArrayList<T>(list);
System.out.println(items.size() + " items returned.");

The query is :
SELECT * FROM `event` WHERE `date`='2011-09-28' AND start_time>='9:45:00' AND start_time<='24:0:00' ORDER BY `date` ASC

Using hibernate native query interface it returns 1 result.
If I copy/paste this query into PhpMyAdmin, it returns 11 results.

As you may see, I tried also without .addEntity(itemClass), because I suspected it was an entity mapping issue. But the result is exactly the same : only on item.

If someone has a suggestion please ...


Top
 Profile  
 
 Post subject: Re: Native query returning different result than PhpMyAdmin
PostPosted: Tue Sep 27, 2011 4:11 am 
Newbie

Joined: Tue Sep 27, 2011 3:34 am
Posts: 2
I renamed "date" to "event_date" with the same result.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.