如何删除Hibernate弃用警告消息 [英] How to remove Hibernate deprecation warning message
问题描述
我们有一个查询:
列表< Book> books = session.createQuery(
from Book b where:x member of b.bookCategories)
.setParameter(x,crimeStory)
.list();
但是当执行这个查询时,我们收到了一条警告信息:
WARN 10:19:41弃用:HHH90000016:在HQL / JPQL查询中找到不推荐使用的
'collection property'语法[null.elements];
使用集合函数语法来代替[elements(null)]。
我试图将查询改为:
列表< Book> books = session.createQuery(
from Book b where?in elements(b.bookCategories))
.setParameter(0,crimeStory).list();
但警告信息仍然存在。
请帮我解决这个警告。
P / s:我们目前使用Hibernate 5.0.2
这是合法的JPA,因此不应该被弃用。另请参阅 http://download.oracle.com/otndocs/ jcp / persistence-2.0-fr-oth-JSpec / 。
请参阅 https://hibernate.atlassian.net/browse/HHH-10621 为JIRA提供了关于此错误的信息。
您可以通过将 (我知道这是一个老问题,但在JIRA调用中使用) We have a query: 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: but the warning message was still there. Please help me to fix this warning. P/s: We are currently using Hibernate 5.0.2 It is legal JPA and so should not be deprecated. See also http://download.oracle.com/otndocs/jcp/persistence-2.0-fr-oth-JSpec/. See https://hibernate.atlassian.net/browse/HHH-10621 for the JIRA about this bug. You could just hide the message by adding (I know this was an old question but it is used in the JIRA call) 这篇关于如何删除Hibernate弃用警告消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! log4j.logger.org.hibernate.orm.deprecation = error
添加到您的 log4j.properties $ c中来隐藏该消息$ c $。
List<Book> books = session.createQuery(
"from Book b where :x member of b.bookCategories")
.setParameter("x", crimeStory)
.list();
List<Book> books = session.createQuery(
"from Book b where ? in elements(b.bookCategories)")
.setParameter(0, crimeStory).list();
log4j.logger.org.hibernate.orm.deprecation=error
to your log4j.properties
.