Hello,
I have a problem with a findByPrimaryKey method which I have in my
Data Access Object File. The method returns a java List and I am casting
to a list in my code but I get java.lang.ClassCastException. ANY idea why the exception could be occurring? - many thanks.![]()
List heldPrice = (List)
super.getHandle().findByPrimaryKey(item.getComposi te_id);
The handle is fine and composite_id passed appears to have been built correctly. It is made up of three fields.
The composite_id was set using the setter method for it on the Item object.
Item is a DB Table and has a object representation as Item with itemDAO being the data access mapping file.
the itemDAO has the following method:
public final List findByPrimayKey(final ItemPK itemPK)
throws finderDAOException{
Object [] ObjectArray = ( itemPK.getItem(),
itemPK.getItemDate,
itemPK.getSource()};
Type[] Array = { Hibernate.BIG_DECIMAL,
Hibernate.BIG_DECIMAL,
Hibernate.String};
return get HibernateTemplate().find(
" from Item item where item.composite_id.item = ?" +
" and item.composite_id.itemDate =?" +
" and item.composite_id.itemSource =?",
ogbjectArry,
typrArray);
}
}
}


Reply With Quote