I'm trying to filter using an array of objects, because sometimes is many to many or one to many the kind of object that i need to filter. I'm using the flowing code :
...getSession().createQuery("from Person where addresses in ( :L0)");
qry.setParameterList("L0", (Collection)val);
val is an arrayList... of Objects "Address"
and hibernate create that query:
Hibernate: select person0_.id as id21_, person0_1_.customerId as customerId21_, person0_.documentNumber as document2_26_, person0_.firstName as firstName26_, person0_.lastName as lastName26_, person0_.email as email26_, person0_.companyId as companyI
d26_ from persons person0_ inner join contacts person0_1_ on person0_.id=person0_1_.id, contact_addresses addresses1_, addresses address2_ where person0_.id=addresses1_.contactId and addresses1_.addressId=address2_.id and ({non-qualified-property-ref
} in (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,
? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?))
the query contains an {non-qualified-property-ref} ... but the mapping appear to be ok, i dont know what kind of error im having in that code or mapping
thats the involved part of the mapping file
<class name="Contact" table="contacts" abstract="true" polymorphism="explicit">
<id name="id" type="long">
<generator class="native"/>
</id>
<set name="addresses" table="contact_addresses" cascade="all">
<key column="contactId"/>
<many-to-many column="addressId" class="Address"/>
</set>
.....
<joined-subclass name="Person" table="persons">
<key column="id"/>
<property name="documentNumber"/>
<property name="firstName"/>
<property name="lastName"/>
<property name="email"/>
<many-to-one name="company" column="companyId"/>
</joined-subclass>
</class>
<class name="Address" table="addresses">
<id name="id" >
<generator class="native"/>
</id>
....
<property name="city"/>
....
</class>
then, i got a exception....
11:00:09,625 WARN JDBCExceptionReporter:77 - SQL Error: 0, SQLState: 07001
11:00:09,640 ERROR JDBCExceptionReporter:78 - No value specified for parameter 1
11:00:09,656 WARN RequestProcessor:528 - Unhandled Exception thrown: class org.hibernate.exception.SQLGrammarException
11:00:09,687 ERROR [action]:250 - Servlet.service() para
servlet action lanz� excepci�n
java.sql.SQLException: No value specified for parameter 1
I hope that to be posible to do in hibernate, but im not sure how to do that... if someone know, it will appreciate the help

[ May 18, 2007: Message edited by: gustavo sanchez ]