Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Hibernate and CATSEARCH: passing text_query as parameter caused QueryParameterException

fanny983Jan 28 2016 — edited Jan 28 2016

Hi,

if I write JPA query as follow

SELECT

  s

FROM

  MyTable s

WHERE

  CATSEARCH(DESCRIPTION, '

  <query>

  <textquery grammar="context"> $CLASSIFICATION | $INTERNATIONAL

  </textquery>

  </query>',NULL)> 0

this works and the generator SQL query is

select

    ...

from

    MyTable

where

    CATSEARCH(DESCRIPTION, ' <query> <textquery grammar="context">$CLASSIFICATION | $INTERNATIONAL </textquery> </query>', null)>0

But, if I replace text_query with a parameter as follow

SELECT

  s

FROM

  MyTable s

WHERE

  CATSEARCH(DESCRIPTION, '

  <query>

  <textquery grammar="context"> :keywords

  </textquery>

  </query>',NULL)> 0

And set parameter from outside as

query.setParameter("keywords", input.getKeywords());

I have the following error:

org.hibernate.QueryParameterException: could not locate named parameter [keywords]

Any idea for this problem? How to set parameters?

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 25 2016
Added on Jan 28 2016
1 comment
918 views