We have a query:
List<Book> books = session.createQuery(
"from Book b where :x member of b.bookCategories")
.setParameter("x", crimeStory)
.list();
But when executing this query, we got a warning message:
WARN 10:19:41 deprecation: HHH90000016: Found use of deprecated 'collection property' syntax in HQL/JPQL query [null.elements]; use collection function syntax instead [elements(null)].
I tried to change the query to:
List<Book> books = session.createQuery(
"from Book b where ? in elements(b.bookCategories)")
.setParameter(0, crimeStory).list();
but the warning message was still there.
Please help me to fix this warning.
P/s: We are currently using Hibernate 5.0.2
As a side note, to simply hide (not fix) messages like this, as of 2017 and Log4j2, use org.hibernate.orm.deprecation
, for example:
<Logger name="org.hibernate.orm.deprecation" additivity="false" level="WARN">
<RegexFilter regex=".*HHH90000016.*" onMatch="DENY" onMismatch="NEUTRAL"/>
…
</Logger>
Be sure to use the specific code for your particular deprecation message, in this particular case it was HHH90000016
, but for Criteria-API deprecation warnings it would be HHH90000022
, and so on.
Or to disable all Hibernate deprecation messages (not recommended):
<Logger name="org.hibernate.orm.deprecation" additivity="false" level="ERROR">
…
</Logger>
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