I have a related problem. In the example dharmendra gave below, assume class XYZ stored a single object of class PQR instead of a list. Then assume you have two sublcasses of PQR: ABC and DEF. My question is how to use criteria to find all XYZ objects whose PQR member variable is of type ABC.
That is, given the following relationships,
Code:
Class XYZ
{
PQR pqr;
}
Class PQR{ }
Class ABC extends PQR { }
Class DEF extents PQR { }
how do I construct a criteria query to return all XYZ objects where pqr is of type ABC?
A simple real-world example is an item and bid construct. Assuming items have categories like Electronics, Books, Music, that are all subclasses of a master Item class, and assuming that each bid stores a reference to an item, how could you find all bids for Electronics items?
Thanks,
Jacob
Code: