Hi,
this issue is present in both 5.2.17 and 5.4.0. It wasn't present in 4.3.x we used before.
The thing is that org.hibernate.Query#setParameter(String, Object) is now much slower that it used to be.
We have a customer that generates query with 50000 parameters, and now it takes 30s to just set these params. The issue is lookup into map values in ParameterMetadataImpl#containsReference that is called for every param internally in hibernate. Adding a cache here, reduces the time to set the params to 1s on my machine.
Will attach pull request. For us, the severity is critical, so we went with custom build of hibernate, but it would be nice if that can also be fixed in upstream.
Thanks,
Tomas