-->
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: HQL with positional parameters and NOT IN
PostPosted: Wed Dec 24, 2008 8:33 am 
Newbie

Joined: Thu May 15, 2008 10:04 am
Posts: 7
Location: uk
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.2.6
Database version: Oracle 9

Hi

Im trying to run an HQL query that uses both positional characters and the NOT IN statement and it's not returning the correct results.

The statement is along the lines of

select o.column1 from TABLEA o where o.column2 = ? AND o.column3 not in ( ? )

where both column2 and column 3 are varchar2 in the db.

If I actually explicitly build the statement in the code then it returns the correct value, ie

select o.column1 from TABLEA o where o.column2 = 'x' AND o.column3 not in ( 'foo','bar' )

This implies that the substitution of the positional parameters is not happening correctly - the first one is straightforward, so it's going to be the second one. The value of the second parameter is 'foo','bar' (the single quotes are present)

So I have a couple of questions:
1) Is it possible to use a list of values when using a positional parameter. If so what should the format be?
2) Despite my best efforts at debugging, I can never actually see the sql statement that gets executed (ie with the values of the positional parameters included in the sql). Is it possible to view this? If so please let me know the class/method/variable as I can't find it and Im sure that would make it very obvious what's wrong.

Cheers
Al.


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.