-->
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: JPA query does not return anything but underlying sql does !
PostPosted: Fri Nov 09, 2012 4:45 pm 
Newbie

Joined: Fri Nov 09, 2012 4:33 pm
Posts: 1
I have simple JPA query as following. I run actual SQL (logged in trace log), it does return rows, but with JPA /Hibernate it does not !

Code:
           
            q = em.createQuery("SELECT o FROM Tuser AS o WHERE o.in :tuserList AND  SUBSTRING(o.createdOn,1,11)  = '09-NOV-2012'", Tuser.class);
            q.setParameter("tuserList", tuserList);
            List list = q.getResultList();




If I remove SUBSTRING clause, it returns. But with SUBSTRING clause underlying query does return result in SQLDeveloper.


Top
 Profile  
 
 Post subject: Re: JPA query does not return anything but underlying sql does !
PostPosted: Wed Nov 14, 2012 4:40 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Hi,

I suggest you to use p6spy (or any other jdbc-profiler) in order to detect into which sql-statement exactly hibernate transforms your original query. I guess this will uncover the problem.


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.