Hello,
on 04.08. I have asked a question and have not got any
answer. It is important to me, so I will try to reformulate.
Any help will be appreciated, for example a piece of
code or an explanation how to use the method
Criteria.addIn(String attributeName, Query subQuery)
for something that cannot be done using path expressions
(i.e., what other posters call "nested queries");
Here is what I am doing:
I have a model of the form
[A] <--1--n--> [B] --1--1--> [C]
Moreover, B and C are abstract;
C has a lot of subclasses and B has a few.
The concrete subclasses of B are mapped to one table,
those of C are mapped to distinct tables.
I can formulate org.apache.ojb.broker.query.Query qryB
to specify a particular set of B instances.
Now I would like to use the method
Criteria.addIn(String attributeName, Query subQuery)
(or something else) to formulate a query
(i) for all A instances for which there is a B-instance that
matches qryB and has a reference to a specific C-instance z.
(ii) for all C instances for which there is a B-instance that
matches qryB and is referenced by a specific A-instance x.
Of course, each of these queries should be translated into a
single SQL statement.
I think at least (i) should be possible. I have realized that
(ii) is very difficult because C has so many subclasses.
The above method is not covered by the OJB junit tests, and
it seems to me that it is hardly useful.
BTW: the OQL standard supports such queries.
I think it is something like
(i) SELECT a from A WHERE a.b in SELECT b from B WHERE (qryB) and b.c = z
Can anybody help?
Olli
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]