Passing lists with named parameters and HQL
I've just been experimenting with passing lists into an HQL statement. I can get it to work with named parameters,but not with positional parameters.
This works:
result = ORMExecuteQuery( "from Art where id in (:list) and issold = :issold", {list=[1,2,3],issold=true} );
This doesn't (and I didn't expect it to):
result = ORMExecuteQuery( "from Art where id in (?) and issold = ?", [1,2,3,true] );
However, I would expect this to work which it doesn't:
result = ORMExecuteQuery( "from Art where id in (?) and issold = ?", [[1,2,3],true] );
I nearly always use named parameters, so this doesn't really bother me, but I feel the last example should work.
You could do this, but it seems a bit like a hack to me.
result = ORMExecuteQuery( "from Art where id in (?,?,?) and issold = ?", [1,2,3,true] );
- Posted in:
- ColdFusion
- Hibernate


Comment by Josh Curtiss – September 06, 2011
Comment by John Whish – September 06, 2011