-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: QueryParameterException: could not locate named Parameter
PostPosted: Thu Jan 12, 2012 12:49 pm 
Newbie

Joined: Thu Jan 12, 2012 12:41 pm
Posts: 1
Hello,

i'm getting this exception by trying to fetch some objects.

I defined the class like this:

Code:
<hibernate-mapping>

  <class name="Menu" table="M_MENU_DEF">
    <id name="id"></id>
    <property column="KEY" name="key"/>
    <set name="items" inverse="true">
      <key/>
      <one-to-many class="MenuItem"/>
      <loader query-ref="items"/>
    </set>
  </class>

  <class name="MenuItem" table="M_MENU_ITEM_DEF">
    <id name="id"></id>
    <property column="KEY" name="key"/>
    <property column="BEANNAME" name="beanName"/>
    <property column="BEANMETHOD" name="beanMethod"/>
  </class>
 
  <sql-query name="items">
      <load-collection alias="item" role="Menu.items"/>
      <![CDATA[
        SELECT {item.*}
          FROM M_MENU_ITEM_DEF item
          WHERE ID IN(
            SELECT T2.M_MENU_ITEM_DEF_FK
              FROM M_MENU_ITEM_ACCESS_RIGHT_CONF T2
              WHERE T2.ROLE_FK IN (:roles) OR T2.ROLE_FK=0
          )       
      ]]>
  </sql-query> 

</hibernate-mapping>


The Dao-Method looks like this:
Code:
  public Set<Menu> fetchMenu(Set<String> roleNames) {
    LogUtil.methodEnteredLog(LOG, "roleNames=" + roleNames);
    Set<Menu> menu = new HashSet<Menu>();
    getHibernateTemplate().getSessionFactory()
            .getCurrentSession()
            .createQuery("from Menu")           
            .setParameterList("roles", roleNames);
    LogUtil.methodReturningLog(LOG, menu);
    return menu;
  }


Does somebody know what I'm doing wrong? Please, help!

Thnx in advance


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.