hi michael, afaik there's no way to link a subquery with the top query. this would be a very helpful feature !
jakob ----- Original Message ----- From: "Michael Kapanadze" <[EMAIL PROTECTED]> To: "OJB Users List" <[EMAIL PROTECTED]> Sent: Friday, January 10, 2003 4:08 PM Subject: Linking to top-level tables in sub-queries > Hello, > > I'm trying to use PersistanceBroker interface. Suppose, I have the following > code: > > //start > Query class2Query = QueryFactory.newQuery(Class2.class,(Criteria)null); > Criteria crit1 = new Criteria(); > crit1.addExists(class2Query); > > Query class1Query = QueryFactory.newQuery(Class1.class, crit1); > Collection results = broker.getCollectionByQuery(class1Query); > //end > > As I understand, result collection will contain records, if class2Query > returns at least one object as result. > > Now I have question: can I implement something like following SQL command > using PersistenceBroker API? > > SELECT * FROM table1 t1 > WHERE EXISTS (SELECT * FROM table2 t2 WHERE t2.field2 = t1.field1) > > So, can I mark Class1 object to access its fields from class2Query (Like I > did it in SQL)? > > Thanks, > Mikheil > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
