Hi,
It seems that the InExpression does not properly work with Component or Composite-Id 's
I have following hbm.xml :
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="be.kuleuven.toledo.model.bean.User" table="TLUSER">
<composite-id name="sourcedId" class="be.kuleuven.toledo.model.bean.SourcedId">
<key-property name="source" column="DATASOURCE" />
<key-property name="id" column="SOURCEID" />
</composite-id>
<timestamp name="modifiedDate" column="MODDATE"/>
<property name="userId" column="USERID" type="long" access="field"/>
<property name="inet" column="INET" type="string"/>
<property name="firstName" column="VNAAM" type="string"/>
<property name="familyName" column="FNAAM" type="string"/>
<property name="emailAddress" column="EMAIL" type="string"/>
<property name="creationDate" column="CRDATE" type="timestamp"/>
</class>
</hibernate-mapping>
And when executing this
Code:
// build a list of of objects of composed-id
String[] ids = {"u0040926","u0040925"};
List list = new ArrayList();
for (int i = 0; i < ids.length; i++) {
SourcedId sourcedId = new SourcedId();
sourcedId.setId(ids[i]);
sourcedId.setSource("KULEUVEN");
list.add(sourcedId);
}
// find all objects with composed-id in list
session.createCriteria(User.class).add(
Expression.in("sourcedId", list)).list();
it returns no results when my list is larger than 1 element, though, if I set hibernate.show_sql=true and execute the query manually, everything's right.... InExpression only works for simple properties, am I right?