I'm using a filter and parameter on a one to many set (a person can have many cats) and when I go to set the parameter, I get a parameter not found message.
I'm using Hibernate 3.0.5 and here is the code and trace.
MAIN:
Session session = HibernateSessionFactory.currentSession();
Transaction tx = session.beginTransaction();
Person person = (Person) session.createCriteria(Person.class).add(Expression.eq("personId", "4000000789")).uniqueResult();
assertNotNull(person );
session.enableFilter("catsFilter").setParameter("personId", 4000000789);
Set cats = person .getCats();
CLASS:
This is the code in my Person hbm xml.....
<set name="cats" cascade="all" lazy="true">
<key>
<column name="Person_ID" />
</key>
<one-to-many class="Cat" />
<filter name="catsFilter" />
</set>
<filter-def name="catsFilter" condition=":personId = Person_ID" >
<filter-param name="personId" type="java.util.Integer" />
</filter-def>
TRACE:
java.lang.IllegalArgumentException: Undefined filter parameter [personId]at org.hibernate.impl.FilterImpl.setParameter(FilterImpl.java:59)
|