简体   繁体   中英

org.hibernate.Query cannot be converted to org.hibernate.query.Query [javac] Query query = session.createQuery(sqlQuery);

i'm updating my project from hibernate 4.3.5 to 5.2.10. i updated the jars but getting below error during ant build.

error: incompatible types: org.hibernate.Query cannot be converted to org.hibernate.query.Query [javac] Query query = session.createQuery(sqlQuery);

i can't understand why? Any help will be appreciated.

The Query object type of query is org.hibernate.query.Query . But the return value of method session.createQuery(sqlQuery) is org.hibernate.Query , not same type of query variable.

Your classpath should contain only single version of hibernate jars, version 5 in this case. Please remove any other version of jars if present.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM