Beginner |
|
Joined: Thu Feb 26, 2004 11:32 am Posts: 32
|
I am posting again as my previous query did not get any response. Hopefully I am clearer this time:
I am using hibernate-2.1 with joined-subclass mapping
I have 3 classes BaseAttributes, DerivedAttributes1 and DerivedAttributes2
BaseAttributes{
int baseAttribute;
}
DerivedAttributes1 extends BaseAttributes{
int attribute1;
}
DerivedAttributes2extends BaseAttributes{
int attribute2;
}
I have a Employee Class as shown
Employee{
Set attributes
}
mapping in Employee.hbm.xml
<set
name="attributes"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="EMPLOYEE_ID" />
</key>
<one-to-many
class="persistence.BaseAttributes"
/>
</set>
The set can contain objects of derived type 1 or 2.
I am not able to use a collection filter by using derived class attributes in the query :
session.createFilter(employee.getAttributes(), "where this.attribute1 = xxx");
I get the following error
net.sf.hibernate.QueryException: could not resolve property: attribute1 of: persistence.BaseAttributes [where this.attribute1 = xxx]
Is there a way to handle this in hibernate.
TIA
splash
|
|