title: java.lang.illegalargumentexception no query defined for that name [...]
body: <p>I have a native query in plsql like this;</p>
  
  <pre><code>create or replace package body DBPK_Monitoring is
    PROCEDURE monitoring_Search(cur OUT SYS_REFCURSOR,) is
      query       VARCHAR(30000);
      whereClause VARCHAR(10000);
  
    BEGIN
      whereClause := whereClause || '  and   ( cnt.contract_status!=7)';
  
      query := ' select itemTitle as "itemTitle", numberOfRow as "numberOfRow" ,
                 orderNumber as "orderNumber",createDate as "createDate",
                 priorityNumber as  "priorityNumber"  
          from buy_buy_order bbo
         inner join buy_buy_order_item bbi
            on bbi.buy_order_id = bbo.id
          left outer join core_User_Role shoUserRole
            on shoUserRole.id = bbi.buy_Expert_Id      
  
           ' || whereClause || ' order by ' || orderBy ||
               ') e  WHERE e.rowNO&gt;  ' || lower_Bound || ' and e.rowNO&lt;=' ||
               upper_Bound;
      OPEN cur FOR query
    end monitoring_Search;
  
  end DBPK_Monitoring;
  </code></pre>
  
  <p>I use of this query in repository with hql like this :</p>
  
  <pre><code> Session session = getSession();
          Query query = session.getNamedQuery("monitoring_Search").setResultTransformer(Transformers.aliasToBean(MonitoringDto.class));
          int firstResultIndex = searchOption.getPageNumber() * searchOption.getPageSize();
          query.setInteger("lower_Bound", firstResultIndex);
          query.setParameter("upper_Bound", firstResultIndex + searchOption.getPageSize());
          query.setString("orderBy", searchOption.getOrder());
          query.setParameter("buyOrderNumber", buyOrderNumber);        
          List&lt;MonitoringDto&gt; list = query.list();
          int count = (list.size() &gt; 0L) ? list.get(0).getNumberOfRow() : 0;
          return new QueryResult&lt;MonitoringDto&gt;(searchOption.getPageNumber(), count, searchOption.getPageSize(), list);
  </code></pre>
  
  <p>When I run program, I get this error:</p>
  
  <blockquote>
    <p>java.lang.illegalargumentexception no query defined for that name
    [monitoring_Search]</p>
  </blockquote>
  
  <p>How can I fix this?</p>