lead me to believe that I hadn't RTFM as thoroughly as I should have. This
proved to be correct. So I did more reading on the site and most of my
questions have been answered. But this time I swear I've read the entire site
and I'm just not sure how to do this.
I have 3 classes, TheObject, ForeignObject and SubObject.
public class TheObject
{ Integer oid;
ForeignObject foreignObject;
}
public class ForeignObject
{ Integer foreignId;
String otherStuff;
}
public class SubObject extends TheObject
{ Integer oid;
String someString;
}I want to be able to query SubObject and get all the information for related TheObjects and ForeignObjects.
This works: ------------------------------------------------------------------ Criteria crit = new Criteria(); crit.addEqualTo( "foreignObject.otherStuff", "blahBlah" ); Query q = QueryFactory.newQuery( TheObject.class, crit ); Collection tObjects = broker.getCollectionByQuery( q ); ------------------------------------------------------------------ Exactly what I wanted, within each TheObject in tObjects I can access ForeignObject by obj.getForeignObject().getOtherStuff().
Now, when I try to run the same query on SubObject, it fails. Somewhat
understandably because "foreignObject.otherStuff" is not mapped in SubObject.
------------------------------------------------------------------
Criteria crit = new Criteria();
crit.addEqualTo( "foreignObject.otherStuff", "blahBlah" );
Query q = QueryFactory.newQuery( SubObject.class, crit );
Collection sObjects = broker.getCollectionByQuery( q );
------------------------------------------------------------------
I thought that since SubObject extends TheObject that "foreignObject.otherStuff"
would be recognized. Its not. Is there some way to make this work?
I will continue to scour the site but if someone has already explained this before
please point me to the link.
Thanks a lot.
Charlie
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
