When I use named parameters in my HQL statement ...
INSERTINTO MyClass (property1, property2, component1)
SELECT :newProp, property2, :newComp FROM MyClass
WHERE property1 = :oldProp
AND component1.property1 = :oldCompProp1
AND component1.property2 = :oldCompProp2
... this leads to this illegal SQL statement ...
INSERTINTO MyTable (MyColumn1, MyColumn2, MyComponentColumn1, MyComponentColumn2)
SELECT ?, MyColumn2, (?, ?) FROM MyTable
WHERE MyColumn1 = ?
AND MyComponentColumn1 = ?
AND MyComponentColumn2 = ?
... the parantheses in the SELECT clause (?, ?) which are added by org.hibernate.hql.internal.ast.tree.ParameterNode#getRenderText are invalid on MS SQL Server!
This would be valid:
INSERTINTO MyTable (MyColumn1, MyColumn2, MyComponentColumn1, MyComponentColumn2)
SELECT ?, MyColumn2, ?, ? FROM MyTable
WHERE MyColumn1 = ?
AND MyComponentColumn1 = ?
AND MyComponentColumn2 = ?