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: NamedQuery / createQuery with filter
PostPosted: Wed Jul 07, 2010 9:05 am 
Newbie

Joined: Wed Jul 07, 2010 8:36 am
Posts: 3
i got the named query bellow and it is not return anything when a execute a command such as query.list(). When i execute the generated query on my DB (Oracle 10g), it runs without any problems.

Code:
"from Question q where q.informy = :informy"


but when i remove the filter, it works perfectly

Code:
"from Question"


'informy' is an entity (should i'd used Informy - capital 'I'), and i have a unidirectional relation from Question

Code:
Class Question
          ...
          // INFORMY_ID is a FK in Question table and the PK of Informy
          @ManyToOne
          @JoinColumn(name="INFORMY_ID")
          private Informy informy


on the DAO ive got:
Code:
Query query = getSession().getNamedQuery("CheckQuestion").setEntity("informy", question.getInformy());
List questions = query.list();
// questions.size() returns 0


i searched over the internet and read a few books i have, but no clue. Any ideas where the problem may be? Even when ive changed to native sql, it is not working.

Anyway, tonight im going to struggle a lil bit more.
cya


Top
 Profile  
 
 Post subject: Re: NamedQuery / createQuery with filter
PostPosted: Wed Jul 07, 2010 7:52 pm 
Newbie

Joined: Wed Jul 07, 2010 8:36 am
Posts: 3
stupid problem solved!!


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.