Since Hibernate 5.2 Query<R>.setParameter(String name, Object val, Type type) is deprecated and the javadoc says to use org.hibernate.query.Query instead.
I did this:
org.hibernate.query.Query<String> q = s.createQuery("select f from Foo f where f.bar = :bar", String.class);
q.setParameter("bar", "bar", org.hibernate.type.StringType.INSTANCE);
My Eclipse still complains that .setParameter( is deprecated.
Any ideas on how can I override the type when binding a parameter to a Query?
If you see the class javadoc for org.hibernate.Query, you'll notice that the entire interface contract was deprecated and replaced with the new org.hibernate.query.Query contract.
The new query contract in org.hibernate.query.Query also has its equivalent:
Query<R> setParameter(String name, Object value, Type type);
UPDATE
There was an issue logged HHH-10839 that was fixed in the 5.2.1.Final release. That fix added this method back to the org.hibernate.query.Query contract.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With