A substitute for deprecated setParameter(String name, Object val, Type type)
<p>Since Hibernate 5.2 <code>Query&lt;R&gt;.setParameter(String name, Object val, Type type)</code> is deprecated and the javadoc says to use <code>org.hibernate.query.Query</code> instead.</p>

<p>I did this:</p>

<pre><code>org.hibernate.query.Query&lt;String&gt; q = s.createQuery("select f from Foo f where f.bar = :bar", String.class);
q.setParameter("bar", "bar", org.hibernate.type.StringType.INSTANCE);
</code></pre>

<p>My Eclipse still complains that <code>.setParameter(</code> is deprecated.</p>

<p>Any ideas on how can I override the type when binding a parameter to a Query?</p>