Hi,
Before submitting a Jira Issue I wanted to ask here, maybe someone came across this.
Using Hibernate 3 with a postgresql dialect, I define the following query:
Code:
<sql-query name="manufacturers-specifying-properties">
<return-scalar column="mid" type="integer"/>
<return-scalar column="pid" type="integer"/>
SELECT m.manufacturer_id AS mid, p.fk_property_id AS pid
FROM templates.manufacturer m
INNER JOIN templates.manufacturer_property p
ON m.manufacturer_id = p.fk_manufacturer_id
WHERE ( m.fk_manufacturer_type_id in :types )
AND ( p.fk_property_id in :properties )
</sql-query>
in my code I use
Code:
query.setParameterList( "types", manTypeIds , Hibernate.LONG);
query.setParameterList( "properties" , manufacturerIds, Hibernate.LONG );
Where both parameters are collections (in fact lists of Longs).
Now hibernate produces a bad query:
Code:
SELECT m.manufacturer_id AS mid, p.fk_property_id AS pid FROM templates.manufacturer m INNER JOIN templates.manufacturer_property p ON m.manufacturer_id = p.fk_manufacturer_id WHERE ( m.fk_manufacturer_type_id in ) AND ( p.fk_property_id in ?, ? )
Note that both question marks are at the end of the query, which results in an error. I suspect it is a bug...
When I use query.setParameter(...) instead of setParameterList(...), the question marks are at the right place, but the query would result in another error...
Any clues someone?
Cheers,
Ron