Beginner |
|
Joined: Thu Feb 26, 2004 11:32 am Posts: 32
|
I am using hibernate-2.1 with joined-subclass mapping
I have a base class
EmployeeAttributes{
int attributesId
int dateId;
}
and 2 derived classes
EmpAttType1{
PensionAtt penAtt;
} and EmpAttType2.
Class Employee contains a collection of EmployeeAttributes (of type EmpAtt1 / EmpAtt2 ).
I am trying to use a collection filter to fetch attributes for a given dateId
session.createFilter(employee.getEmployeeAttributes(),"where this.dateId = " + dateId ); works fine
but I am not sure how to typecast in this query so that I can retrieve
pensionAtt for a given dateId
I am trying to do something like :
PensionAtt currentPenAtt = session.createFilter(employee.getEmployeeAttributes(),"select this.pensionAtt where this.dateId = " + dateId );
which doesnt work because object returned by collection is of type 'EmployeeAttribute' and not of 'EmpAttType1'
|
|