简体   繁体   中英

Showing unexpected token while executing Hibernate Query

When i excuting below query showing org.hibernate.hql.ast.QuerySyntaxException: unexpected token: AGAINST near line 1, column 106 [SELECT NAME,address,country,district,state,cpr_no,age FROM tbl_patient_general WHERE MATCH (NAME,cpr_no) AGAINST (:params)]

            Query q3 = session.createQuery("SELECT NAME,address,country,district,state,cpr_no,age FROM tbl_patient_general WHERE MATCH (NAME,cpr_no) AGAINST (:params)");
            q3.setParameter("params", name);

Are you using native SQL or HQL? In first case use session.createSQLQuery() .
AGAINST is not an HQL function/reserved word

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