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.