TypedQuery named parameter gets rendered as multiple SQL parameters

Description

Hello,

I'm encountering an issue with a EntityManger created TypedQuery object.

The query below has several named parameters ("otlx", "obrx", "otly", and "obry").

The issue is that when this query gets sent down to SQL Server, it gets converted into the following:

The issue with this is that the group by clause is not recognized as being the same as one of the selected fields and the following error is returned:

If I modify the sp_executesql string to only use @P0 to @P3, it all works fine but you'll notice that right now, even though the named parameters in the original TypedQuery object is the same, the rendered SQL Query has 12 different parameter values!

How would I go about addressing this issue?

Thanks!

Environment

Hibernate 5.2.10.Final
SqlServer 2008 R2 +

Assignee

Unassigned

Reporter

William Li

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure