You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Phil Warrick <ph...@mcgill.ca> on 2004/03/05 16:29:34 UTC

subqueries: doc

Hi all,

I was wondering if someone could write up something to explain the use 
of subqueries.  I'm deciphering the relevant PB test cases at the moment 
and can probably figure it out, but it looks like an important gap in 
the documentation.

Thanks,

Phil



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Query casts [was: subqueries: doc]

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi phil,

the problem is that most of the methods in SqlQueryStatement do not know from 
which criteria they are called, so we'd have to add Crteria as additional parameter.

jakob

Phil Warrick wrote:

> Hi Jakob,
> 
> I'd be very willing to help out if you think that this is sufficiently 
> useful (it's crucial to my app).  If you could point me in the right 
> direction, I could look into it.
> 
> Phil
> 
> 
>> hi phil,
>>
>> this feature seems really undocumented ! i'll inform brian about it.
>>
>> adding the path-class hint to the criteria would be even more 
>> flexible. but it would require heavy refactoring in SqlQueryStatement.
>>
>> jakob
>>
>> Phil Warrick wrote:
>>
>>> Hi Jakob,
>>>
>>> Great, that's a nice (undocumented) feature that I didn't know about 
>>> :) Now to answer my query (which requires aliases), I think it would 
>>> be necessary to somehow have these hints apply at the Criteria level 
>>> rather than the entire query, something like:
>>>
>>> Criteria crit1 = new Criteria();
>>> crit1.setAlias("alias1");
>>> crit1.addEqualTo("allBs.c.cAttrib", new String("foo1"));
>>> crit1.setPathClass("c", C.class); // maybe unnecesary for base class
>>>
>>> Criteria crit2 = new Criteria();
>>> crit2.setAlias("alias2");
>>> crit1.addEqualTo("allBs.c.dAttrib", new String("foo2"));
>>> crit1.setPathClass("c", D.class);
>>>
>>> crit1.addAndCriteria(crit2);
>>>
>>> Query query = new QueryByCriteria(A.class, crit1);
>>>
>>> Do you think that this (or equivalent) would be a good approach?
>>>
>>> Phil
>>>
>>> Jakob Braeuchi wrote:
>>>
>>>> hi phil,
>>>>
>>>> can't this be done by using a pathClass ? see 
>>>> QueryByCriteriy#addPathClass.
>>>>
>>>> query.addPathClass("a.b.c",D.class);
>>>>
>>>> afaik the oql-cast is not yet supported and i'm not an antlr-guru.
>>>>
>>>> jakob
>>>>
>>>> Phil Warrick wrote:
>>>>
>>>>  > Hi Jakob,
>>>>  >
>>>>  > I have concluded that the missing feature here is an OQL-style 
>>>> cast (to
>>>>  > downcast the C to a D).  In your opinion, would adding this feature
>>>>  > involve a major refactoring or could it be a straightforward 
>>>> addition to
>>>>  > the PB-api?
>>>>  >
>>>>  > Thanks,
>>>>  >
>>>>  > Phil
>>>>  >
>>>>  >
>>>>  >
>>>>  > Philip Warrick wrote:
>>>>  >
>>>>  >> Hi again,
>>>>  >>
>>>>  >> A small clarification, the query that I'd like to do is a little 
>>>> more
>>>>  >> complicated:
>>>>  >> find all A's with aAttribute = "foo" and having a D with
>>>>  >> dAttribute = "bar" and a C with cAttribute = "foobar".
>>>>  >>
>>>>  >> My original query could be achieved efficiently by searching for 
>>>> the D's
>>>>  >> with the two criteria:
>>>>  >> d.b.a.aAttribute = "foo" AND
>>>>  >> d.dAttribute = "bar"
>>>>  >>
>>>>  >> and then navigating to the A object(s) which should be cached.
>>>>  >>
>>>>  >> Phil
>>>>  >>
>>>>  >>  > Hi Jakob,
>>>>  >>  >
>>>>  >>  > Thanks for this writeup.
>>>>  >>  >
>>>>  >>  > Here's an example of a query that I'd like to perform:
>>>>  >>  >
>>>>  >>  > A-1------M-B-1------M-C
>>>>  >>  >                        |
>>>>  >>  >                        /\
>>>>  >>  >                        --
>>>>  >>  >                         |
>>>>  >>  >                         D
>>>>  >>  >
>>>>  >>  > i.e. A has a 1-M association with B, B has a 1-M association 
>>>> with C
>>>>  >> and
>>>>  >>  > D is one subclass of C
>>>>  >>  >
>>>>  >>  > I'd like to query for all A's with aAttribute = "foo" having 
>>>> a D with
>>>>  >>  > dAttribute = "bar".
>>>>  >>  >
>>>>  >>  > Obviously I cannot use a criteria like "a.b.c.dAttribute".
>>>>  >>  >
>>>>  >>  > I can query for all the D's first, then iterate through the
>>>>  >>  > corresponding A's and check for the aAttribute, but I'd like 
>>>> to do
>>>>  >> this
>>>>  >>  > in one query (and let the dbms do most of the work).
>>>>  >>  >
>>>>  >>  > Sounds like a job for a subquery, but I am not sure if I can 
>>>> do this
>>>>  >>  > with PB queries and subqueries.  Can anyone help?
>>>>  >>  >
>>>>  >>  > Phil
>>>>  >>  >
>>>>  >>  >
>>>>  >>  > Jakob Braeuchi wrote:
>>>>  >>  >  > hi phil,
>>>>  >>  >  >
>>>>  >>  >  > i added a small docu to query.xml
>>>>  >>  >  >
>>>>  >>  >  > jakob
>>>>  >>  >  >
>>>>  >>  >  > Phil Warrick wrote:
>>>>  >>  >  >
>>>>  >>  >  >  > Hi again,
>>>>  >>  >  >  >
>>>>  >>  >  >  > I came across some discussions with Jakob from last 
>>>> Sept. about
>>>>  >>  > allowing
>>>>  >>  >  >  > references to parents in subqueries.  Did anything come 
>>>> of this?
>>>>  >>  >  >  >
>>>>  >>  >  >  > The reason I'm asking is that after six months of using 
>>>> OJB in
>>>>  >>  >  >  > production to get data into the system (ojb has been rock
>>>>  >> solid!)
>>>>  >>  > it's
>>>>  >>  >  >  > time for many, many complex queries to get data out 
>>>> (similar to
>>>>  >>  > Oliver
>>>>  >>  >  >  > Matz's queries:
>>>>  >>  >  >  >
>>>>  >>  >  >
>>>>  >>  >
>>>>  >> 
>>>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
>>>>
>>>>  >> 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>> 
>>>>
>>>>  >>
>>>>  >>  >
>>>>  >> 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>>
>>>>  >> 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>> 
>>>>
>>>>  >>
>>>>  >>  >
>>>>  >>  >  >
>>>>  >>  >
>>>>  >> 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>>
>>>>  >>
>>>>  >>  >
>>>>  >> 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>>
>>>>  >> 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>>>). 
>>>>
>>>>  >>
>>>>  >>  >
>>>>  >>  >  >
>>>>  >>  >  >  >  I'm a bit concerned that I'm going to have to resort 
>>>> to raw
>>>>  >> SQL.
>>>>  >>  >  >  >
>>>>  >>  >  >  > Thanks,
>>>>  >>  >  >  >
>>>>  >>  >  >  > Phil
>>>>  >>  >  >  >
>>>>  >>  >  >  > Phil Warrick wrote:
>>>>  >>  >  >  >
>>>>  >>  >  >  >> Hi all,
>>>>  >>  >  >  >>
>>>>  >>  >  >  >> I was wondering if someone could write up something to 
>>>> explain
>>>>  >>  > the use
>>>>  >>  >  >  >> of subqueries.  I'm deciphering the relevant PB test 
>>>> cases
>>>>  >> at the
>>>>  >>  >  >  >> moment and can probably figure it out, but it looks 
>>>> like an
>>>>  >>  > important
>>>>  >>  >  >  >> gap in the documentation.
>>>>  >>  >  >  >>
>>>>  >>  >  >  >> Thanks,
>>>>  >>  >  >  >>
>>>>  >>  >  >  >> Phil
>>>>  >>  >  >  >>
>>>>  >>  >  >  >>
>>>>  >>  >  >  >
>>>>  >>  >  >  >
>>>>  >>  >  >  >
>>>>  >>  >  >  >
>>>>  >> 
>>>> ---------------------------------------------------------------------
>>>>  >>  >  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>  >>  >  >  > For additional commands, e-mail: 
>>>> ojb-user-help@db.apache.org
>>>>  >>  >  >  >
>>>>  >>  >  >  >
>>>>  >>  >  >
>>>>  >>  >  >
>>>>  >> 
>>>> ---------------------------------------------------------------------
>>>>  >>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>  >>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>  >>  >  >
>>>>  >>  >
>>>>  >>  >
>>>>  >>
>>>>  >>
>>>>  >
>>>>  >
>>>>  >
>>>>  > 
>>>> ---------------------------------------------------------------------
>>>>  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>  >
>>>>  >
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Query casts [was: subqueries: doc]

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi Jakob,

I'd be very willing to help out if you think that this is sufficiently 
useful (it's crucial to my app).  If you could point me in the right 
direction, I could look into it.

Phil


> hi phil,
> 
> this feature seems really undocumented ! i'll inform brian about it.
> 
> adding the path-class hint to the criteria would be even more flexible. 
> but it would require heavy refactoring in SqlQueryStatement.
> 
> jakob
> 
> Phil Warrick wrote:
> 
>> Hi Jakob,
>>
>> Great, that's a nice (undocumented) feature that I didn't know about 
>> :) Now to answer my query (which requires aliases), I think it would 
>> be necessary to somehow have these hints apply at the Criteria level 
>> rather than the entire query, something like:
>>
>> Criteria crit1 = new Criteria();
>> crit1.setAlias("alias1");
>> crit1.addEqualTo("allBs.c.cAttrib", new String("foo1"));
>> crit1.setPathClass("c", C.class); // maybe unnecesary for base class
>>
>> Criteria crit2 = new Criteria();
>> crit2.setAlias("alias2");
>> crit1.addEqualTo("allBs.c.dAttrib", new String("foo2"));
>> crit1.setPathClass("c", D.class);
>>
>> crit1.addAndCriteria(crit2);
>>
>> Query query = new QueryByCriteria(A.class, crit1);
>>
>> Do you think that this (or equivalent) would be a good approach?
>>
>> Phil
>>
>> Jakob Braeuchi wrote:
>>
>>> hi phil,
>>>
>>> can't this be done by using a pathClass ? see 
>>> QueryByCriteriy#addPathClass.
>>>
>>> query.addPathClass("a.b.c",D.class);
>>>
>>> afaik the oql-cast is not yet supported and i'm not an antlr-guru.
>>>
>>> jakob
>>>
>>> Phil Warrick wrote:
>>>
>>>  > Hi Jakob,
>>>  >
>>>  > I have concluded that the missing feature here is an OQL-style 
>>> cast (to
>>>  > downcast the C to a D).  In your opinion, would adding this feature
>>>  > involve a major refactoring or could it be a straightforward 
>>> addition to
>>>  > the PB-api?
>>>  >
>>>  > Thanks,
>>>  >
>>>  > Phil
>>>  >
>>>  >
>>>  >
>>>  > Philip Warrick wrote:
>>>  >
>>>  >> Hi again,
>>>  >>
>>>  >> A small clarification, the query that I'd like to do is a little 
>>> more
>>>  >> complicated:
>>>  >> find all A's with aAttribute = "foo" and having a D with
>>>  >> dAttribute = "bar" and a C with cAttribute = "foobar".
>>>  >>
>>>  >> My original query could be achieved efficiently by searching for 
>>> the D's
>>>  >> with the two criteria:
>>>  >> d.b.a.aAttribute = "foo" AND
>>>  >> d.dAttribute = "bar"
>>>  >>
>>>  >> and then navigating to the A object(s) which should be cached.
>>>  >>
>>>  >> Phil
>>>  >>
>>>  >>  > Hi Jakob,
>>>  >>  >
>>>  >>  > Thanks for this writeup.
>>>  >>  >
>>>  >>  > Here's an example of a query that I'd like to perform:
>>>  >>  >
>>>  >>  > A-1------M-B-1------M-C
>>>  >>  >                        |
>>>  >>  >                        /\
>>>  >>  >                        --
>>>  >>  >                         |
>>>  >>  >                         D
>>>  >>  >
>>>  >>  > i.e. A has a 1-M association with B, B has a 1-M association 
>>> with C
>>>  >> and
>>>  >>  > D is one subclass of C
>>>  >>  >
>>>  >>  > I'd like to query for all A's with aAttribute = "foo" having a 
>>> D with
>>>  >>  > dAttribute = "bar".
>>>  >>  >
>>>  >>  > Obviously I cannot use a criteria like "a.b.c.dAttribute".
>>>  >>  >
>>>  >>  > I can query for all the D's first, then iterate through the
>>>  >>  > corresponding A's and check for the aAttribute, but I'd like 
>>> to do
>>>  >> this
>>>  >>  > in one query (and let the dbms do most of the work).
>>>  >>  >
>>>  >>  > Sounds like a job for a subquery, but I am not sure if I can 
>>> do this
>>>  >>  > with PB queries and subqueries.  Can anyone help?
>>>  >>  >
>>>  >>  > Phil
>>>  >>  >
>>>  >>  >
>>>  >>  > Jakob Braeuchi wrote:
>>>  >>  >  > hi phil,
>>>  >>  >  >
>>>  >>  >  > i added a small docu to query.xml
>>>  >>  >  >
>>>  >>  >  > jakob
>>>  >>  >  >
>>>  >>  >  > Phil Warrick wrote:
>>>  >>  >  >
>>>  >>  >  >  > Hi again,
>>>  >>  >  >  >
>>>  >>  >  >  > I came across some discussions with Jakob from last 
>>> Sept. about
>>>  >>  > allowing
>>>  >>  >  >  > references to parents in subqueries.  Did anything come 
>>> of this?
>>>  >>  >  >  >
>>>  >>  >  >  > The reason I'm asking is that after six months of using 
>>> OJB in
>>>  >>  >  >  > production to get data into the system (ojb has been rock
>>>  >> solid!)
>>>  >>  > it's
>>>  >>  >  >  > time for many, many complex queries to get data out 
>>> (similar to
>>>  >>  > Oliver
>>>  >>  >  >  > Matz's queries:
>>>  >>  >  >  >
>>>  >>  >  >
>>>  >>  >
>>>  >> 
>>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
>>>
>>>  >> 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>> 
>>>
>>>  >>
>>>  >>  >
>>>  >> 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>
>>>  >> 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>> 
>>>
>>>  >>
>>>  >>  >
>>>  >>  >  >
>>>  >>  >
>>>  >> 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>
>>>  >>
>>>  >>  >
>>>  >> 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>>
>>>  >> 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>>>). 
>>>
>>>  >>
>>>  >>  >
>>>  >>  >  >
>>>  >>  >  >  >  I'm a bit concerned that I'm going to have to resort to 
>>> raw
>>>  >> SQL.
>>>  >>  >  >  >
>>>  >>  >  >  > Thanks,
>>>  >>  >  >  >
>>>  >>  >  >  > Phil
>>>  >>  >  >  >
>>>  >>  >  >  > Phil Warrick wrote:
>>>  >>  >  >  >
>>>  >>  >  >  >> Hi all,
>>>  >>  >  >  >>
>>>  >>  >  >  >> I was wondering if someone could write up something to 
>>> explain
>>>  >>  > the use
>>>  >>  >  >  >> of subqueries.  I'm deciphering the relevant PB test cases
>>>  >> at the
>>>  >>  >  >  >> moment and can probably figure it out, but it looks 
>>> like an
>>>  >>  > important
>>>  >>  >  >  >> gap in the documentation.
>>>  >>  >  >  >>
>>>  >>  >  >  >> Thanks,
>>>  >>  >  >  >>
>>>  >>  >  >  >> Phil
>>>  >>  >  >  >>
>>>  >>  >  >  >>
>>>  >>  >  >  >
>>>  >>  >  >  >
>>>  >>  >  >  >
>>>  >>  >  >  >
>>>  >> 
>>> ---------------------------------------------------------------------
>>>  >>  >  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>  >>  >  >  > For additional commands, e-mail: 
>>> ojb-user-help@db.apache.org
>>>  >>  >  >  >
>>>  >>  >  >  >
>>>  >>  >  >
>>>  >>  >  >
>>>  >> 
>>> ---------------------------------------------------------------------
>>>  >>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>  >>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>>  >>  >  >
>>>  >>  >
>>>  >>  >
>>>  >>
>>>  >>
>>>  >
>>>  >
>>>  >
>>>  > ---------------------------------------------------------------------
>>>  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>>  >
>>>  >
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Query casts [was: subqueries: doc]

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi phil,

this feature seems really undocumented ! i'll inform brian about it.

adding the path-class hint to the criteria would be even more flexible. but it 
would require heavy refactoring in SqlQueryStatement.

jakob

Phil Warrick wrote:
> Hi Jakob,
> 
> Great, that's a nice (undocumented) feature that I didn't know about :) 
> Now to answer my query (which requires aliases), I think it would be 
> necessary to somehow have these hints apply at the Criteria level rather 
> than the entire query, something like:
> 
> Criteria crit1 = new Criteria();
> crit1.setAlias("alias1");
> crit1.addEqualTo("allBs.c.cAttrib", new String("foo1"));
> crit1.setPathClass("c", C.class); // maybe unnecesary for base class
> 
> Criteria crit2 = new Criteria();
> crit2.setAlias("alias2");
> crit1.addEqualTo("allBs.c.dAttrib", new String("foo2"));
> crit1.setPathClass("c", D.class);
> 
> crit1.addAndCriteria(crit2);
> 
> Query query = new QueryByCriteria(A.class, crit1);
> 
> Do you think that this (or equivalent) would be a good approach?
> 
> Phil
> 
> Jakob Braeuchi wrote:
> 
>> hi phil,
>>
>> can't this be done by using a pathClass ? see 
>> QueryByCriteriy#addPathClass.
>>
>> query.addPathClass("a.b.c",D.class);
>>
>> afaik the oql-cast is not yet supported and i'm not an antlr-guru.
>>
>> jakob
>>
>> Phil Warrick wrote:
>>
>>  > Hi Jakob,
>>  >
>>  > I have concluded that the missing feature here is an OQL-style cast 
>> (to
>>  > downcast the C to a D).  In your opinion, would adding this feature
>>  > involve a major refactoring or could it be a straightforward 
>> addition to
>>  > the PB-api?
>>  >
>>  > Thanks,
>>  >
>>  > Phil
>>  >
>>  >
>>  >
>>  > Philip Warrick wrote:
>>  >
>>  >> Hi again,
>>  >>
>>  >> A small clarification, the query that I'd like to do is a little more
>>  >> complicated:
>>  >> find all A's with aAttribute = "foo" and having a D with
>>  >> dAttribute = "bar" and a C with cAttribute = "foobar".
>>  >>
>>  >> My original query could be achieved efficiently by searching for 
>> the D's
>>  >> with the two criteria:
>>  >> d.b.a.aAttribute = "foo" AND
>>  >> d.dAttribute = "bar"
>>  >>
>>  >> and then navigating to the A object(s) which should be cached.
>>  >>
>>  >> Phil
>>  >>
>>  >>  > Hi Jakob,
>>  >>  >
>>  >>  > Thanks for this writeup.
>>  >>  >
>>  >>  > Here's an example of a query that I'd like to perform:
>>  >>  >
>>  >>  > A-1------M-B-1------M-C
>>  >>  >                        |
>>  >>  >                        /\
>>  >>  >                        --
>>  >>  >                         |
>>  >>  >                         D
>>  >>  >
>>  >>  > i.e. A has a 1-M association with B, B has a 1-M association 
>> with C
>>  >> and
>>  >>  > D is one subclass of C
>>  >>  >
>>  >>  > I'd like to query for all A's with aAttribute = "foo" having a 
>> D with
>>  >>  > dAttribute = "bar".
>>  >>  >
>>  >>  > Obviously I cannot use a criteria like "a.b.c.dAttribute".
>>  >>  >
>>  >>  > I can query for all the D's first, then iterate through the
>>  >>  > corresponding A's and check for the aAttribute, but I'd like to do
>>  >> this
>>  >>  > in one query (and let the dbms do most of the work).
>>  >>  >
>>  >>  > Sounds like a job for a subquery, but I am not sure if I can do 
>> this
>>  >>  > with PB queries and subqueries.  Can anyone help?
>>  >>  >
>>  >>  > Phil
>>  >>  >
>>  >>  >
>>  >>  > Jakob Braeuchi wrote:
>>  >>  >  > hi phil,
>>  >>  >  >
>>  >>  >  > i added a small docu to query.xml
>>  >>  >  >
>>  >>  >  > jakob
>>  >>  >  >
>>  >>  >  > Phil Warrick wrote:
>>  >>  >  >
>>  >>  >  >  > Hi again,
>>  >>  >  >  >
>>  >>  >  >  > I came across some discussions with Jakob from last Sept. 
>> about
>>  >>  > allowing
>>  >>  >  >  > references to parents in subqueries.  Did anything come 
>> of this?
>>  >>  >  >  >
>>  >>  >  >  > The reason I'm asking is that after six months of using 
>> OJB in
>>  >>  >  >  > production to get data into the system (ojb has been rock
>>  >> solid!)
>>  >>  > it's
>>  >>  >  >  > time for many, many complex queries to get data out 
>> (similar to
>>  >>  > Oliver
>>  >>  >  >  > Matz's queries:
>>  >>  >  >  >
>>  >>  >  >
>>  >>  >
>>  >> 
>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
>>
>>  >> 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>> 
>>
>>  >>
>>  >>  >
>>  >> 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>
>>  >> 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>> 
>>
>>  >>
>>  >>  >
>>  >>  >  >
>>  >>  >
>>  >> 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>
>>  >>
>>  >>  >
>>  >> 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>
>>  >> 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>>>). 
>>
>>  >>
>>  >>  >
>>  >>  >  >
>>  >>  >  >  >  I'm a bit concerned that I'm going to have to resort to raw
>>  >> SQL.
>>  >>  >  >  >
>>  >>  >  >  > Thanks,
>>  >>  >  >  >
>>  >>  >  >  > Phil
>>  >>  >  >  >
>>  >>  >  >  > Phil Warrick wrote:
>>  >>  >  >  >
>>  >>  >  >  >> Hi all,
>>  >>  >  >  >>
>>  >>  >  >  >> I was wondering if someone could write up something to 
>> explain
>>  >>  > the use
>>  >>  >  >  >> of subqueries.  I'm deciphering the relevant PB test cases
>>  >> at the
>>  >>  >  >  >> moment and can probably figure it out, but it looks like an
>>  >>  > important
>>  >>  >  >  >> gap in the documentation.
>>  >>  >  >  >>
>>  >>  >  >  >> Thanks,
>>  >>  >  >  >>
>>  >>  >  >  >> Phil
>>  >>  >  >  >>
>>  >>  >  >  >>
>>  >>  >  >  >
>>  >>  >  >  >
>>  >>  >  >  >
>>  >>  >  >  >
>>  >> ---------------------------------------------------------------------
>>  >>  >  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>  >>  >  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>  >>  >  >  >
>>  >>  >  >  >
>>  >>  >  >
>>  >>  >  >
>>  >> ---------------------------------------------------------------------
>>  >>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>  >>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>  >>  >  >
>>  >>  >
>>  >>  >
>>  >>
>>  >>
>>  >
>>  >
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>  >
>>  >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Query casts [was: subqueries: doc]

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi Jakob,

Great, that's a nice (undocumented) feature that I didn't know about :) 
Now to answer my query (which requires aliases), I think it would be 
necessary to somehow have these hints apply at the Criteria level rather 
than the entire query, something like:

Criteria crit1 = new Criteria();
crit1.setAlias("alias1");
crit1.addEqualTo("allBs.c.cAttrib", new String("foo1"));
crit1.setPathClass("c", C.class); // maybe unnecesary for base class

Criteria crit2 = new Criteria();
crit2.setAlias("alias2");
crit1.addEqualTo("allBs.c.dAttrib", new String("foo2"));
crit1.setPathClass("c", D.class);

crit1.addAndCriteria(crit2);

Query query = new QueryByCriteria(A.class, crit1);

Do you think that this (or equivalent) would be a good approach?

Phil

Jakob Braeuchi wrote:

> hi phil,
> 
> can't this be done by using a pathClass ? see QueryByCriteriy#addPathClass.
> 
> query.addPathClass("a.b.c",D.class);
> 
> afaik the oql-cast is not yet supported and i'm not an antlr-guru.
> 
> jakob
> 
> Phil Warrick wrote:
> 
>  > Hi Jakob,
>  >
>  > I have concluded that the missing feature here is an OQL-style cast (to
>  > downcast the C to a D).  In your opinion, would adding this feature
>  > involve a major refactoring or could it be a straightforward addition to
>  > the PB-api?
>  >
>  > Thanks,
>  >
>  > Phil
>  >
>  >
>  >
>  > Philip Warrick wrote:
>  >
>  >> Hi again,
>  >>
>  >> A small clarification, the query that I'd like to do is a little more
>  >> complicated:
>  >> find all A's with aAttribute = "foo" and having a D with
>  >> dAttribute = "bar" and a C with cAttribute = "foobar".
>  >>
>  >> My original query could be achieved efficiently by searching for the 
> D's
>  >> with the two criteria:
>  >> d.b.a.aAttribute = "foo" AND
>  >> d.dAttribute = "bar"
>  >>
>  >> and then navigating to the A object(s) which should be cached.
>  >>
>  >> Phil
>  >>
>  >>  > Hi Jakob,
>  >>  >
>  >>  > Thanks for this writeup.
>  >>  >
>  >>  > Here's an example of a query that I'd like to perform:
>  >>  >
>  >>  > A-1------M-B-1------M-C
>  >>  >                        |
>  >>  >                        /\
>  >>  >                        --
>  >>  >                         |
>  >>  >                         D
>  >>  >
>  >>  > i.e. A has a 1-M association with B, B has a 1-M association with C
>  >> and
>  >>  > D is one subclass of C
>  >>  >
>  >>  > I'd like to query for all A's with aAttribute = "foo" having a D 
> with
>  >>  > dAttribute = "bar".
>  >>  >
>  >>  > Obviously I cannot use a criteria like "a.b.c.dAttribute".
>  >>  >
>  >>  > I can query for all the D's first, then iterate through the
>  >>  > corresponding A's and check for the aAttribute, but I'd like to do
>  >> this
>  >>  > in one query (and let the dbms do most of the work).
>  >>  >
>  >>  > Sounds like a job for a subquery, but I am not sure if I can do this
>  >>  > with PB queries and subqueries.  Can anyone help?
>  >>  >
>  >>  > Phil
>  >>  >
>  >>  >
>  >>  > Jakob Braeuchi wrote:
>  >>  >  > hi phil,
>  >>  >  >
>  >>  >  > i added a small docu to query.xml
>  >>  >  >
>  >>  >  > jakob
>  >>  >  >
>  >>  >  > Phil Warrick wrote:
>  >>  >  >
>  >>  >  >  > Hi again,
>  >>  >  >  >
>  >>  >  >  > I came across some discussions with Jakob from last Sept. 
> about
>  >>  > allowing
>  >>  >  >  > references to parents in subqueries.  Did anything come of 
> this?
>  >>  >  >  >
>  >>  >  >  > The reason I'm asking is that after six months of using OJB in
>  >>  >  >  > production to get data into the system (ojb has been rock
>  >> solid!)
>  >>  > it's
>  >>  >  >  > time for many, many complex queries to get data out 
> (similar to
>  >>  > Oliver
>  >>  >  >  > Matz's queries:
>  >>  >  >  >
>  >>  >  >
>  >>  >
>  >> 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
> 
>  >> 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>> 
> 
>  >>
>  >>  >
>  >> 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> 
>  >> 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>> 
> 
>  >>
>  >>  >
>  >>  >  >
>  >>  >
>  >> 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> 
>  >>
>  >>  >
>  >> 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> 
>  >> 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>>>). 
> 
>  >>
>  >>  >
>  >>  >  >
>  >>  >  >  >  I'm a bit concerned that I'm going to have to resort to raw
>  >> SQL.
>  >>  >  >  >
>  >>  >  >  > Thanks,
>  >>  >  >  >
>  >>  >  >  > Phil
>  >>  >  >  >
>  >>  >  >  > Phil Warrick wrote:
>  >>  >  >  >
>  >>  >  >  >> Hi all,
>  >>  >  >  >>
>  >>  >  >  >> I was wondering if someone could write up something to 
> explain
>  >>  > the use
>  >>  >  >  >> of subqueries.  I'm deciphering the relevant PB test cases
>  >> at the
>  >>  >  >  >> moment and can probably figure it out, but it looks like an
>  >>  > important
>  >>  >  >  >> gap in the documentation.
>  >>  >  >  >>
>  >>  >  >  >> Thanks,
>  >>  >  >  >>
>  >>  >  >  >> Phil
>  >>  >  >  >>
>  >>  >  >  >>
>  >>  >  >  >
>  >>  >  >  >
>  >>  >  >  >
>  >>  >  >  >
>  >> ---------------------------------------------------------------------
>  >>  >  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  >>  >  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >>  >  >  >
>  >>  >  >  >
>  >>  >  >
>  >>  >  >
>  >> ---------------------------------------------------------------------
>  >>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  >>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >>  >  >
>  >>  >
>  >>  >
>  >>
>  >>
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >
>  >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Query casts [was: subqueries: doc]

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi phil,

can't this be done by using a pathClass ? see QueryByCriteriy#addPathClass.

query.addPathClass("a.b.c",D.class);

afaik the oql-cast is not yet supported and i'm not an antlr-guru.

jakob

Phil Warrick wrote:

> Hi Jakob,
> 
> I have concluded that the missing feature here is an OQL-style cast (to 
> downcast the C to a D).  In your opinion, would adding this feature 
> involve a major refactoring or could it be a straightforward addition to 
> the PB-api?
> 
> Thanks,
> 
> Phil
> 
> 
> 
> Philip Warrick wrote:
> 
>> Hi again,
>>
>> A small clarification, the query that I'd like to do is a little more
>> complicated:
>> find all A's with aAttribute = "foo" and having a D with
>> dAttribute = "bar" and a C with cAttribute = "foobar".
>>
>> My original query could be achieved efficiently by searching for the D's
>> with the two criteria:
>> d.b.a.aAttribute = "foo" AND
>> d.dAttribute = "bar"
>>
>> and then navigating to the A object(s) which should be cached.
>>
>> Phil
>>
>>  > Hi Jakob,
>>  >
>>  > Thanks for this writeup.
>>  >
>>  > Here's an example of a query that I'd like to perform:
>>  >
>>  > A-1------M-B-1------M-C
>>  >                        |
>>  >                        /\
>>  >                        --
>>  >                         |
>>  >                         D
>>  >
>>  > i.e. A has a 1-M association with B, B has a 1-M association with C 
>> and
>>  > D is one subclass of C
>>  >
>>  > I'd like to query for all A's with aAttribute = "foo" having a D with
>>  > dAttribute = "bar".
>>  >
>>  > Obviously I cannot use a criteria like "a.b.c.dAttribute".
>>  >
>>  > I can query for all the D's first, then iterate through the
>>  > corresponding A's and check for the aAttribute, but I'd like to do 
>> this
>>  > in one query (and let the dbms do most of the work).
>>  >
>>  > Sounds like a job for a subquery, but I am not sure if I can do this
>>  > with PB queries and subqueries.  Can anyone help?
>>  >
>>  > Phil
>>  >
>>  >
>>  > Jakob Braeuchi wrote:
>>  >  > hi phil,
>>  >  >
>>  >  > i added a small docu to query.xml
>>  >  >
>>  >  > jakob
>>  >  >
>>  >  > Phil Warrick wrote:
>>  >  >
>>  >  >  > Hi again,
>>  >  >  >
>>  >  >  > I came across some discussions with Jakob from last Sept. about
>>  > allowing
>>  >  >  > references to parents in subqueries.  Did anything come of this?
>>  >  >  >
>>  >  >  > The reason I'm asking is that after six months of using OJB in
>>  >  >  > production to get data into the system (ojb has been rock 
>> solid!)
>>  > it's
>>  >  >  > time for many, many complex queries to get data out (similar to
>>  > Oliver
>>  >  >  > Matz's queries:
>>  >  >  >
>>  >  >
>>  > 
>> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
>>
>>  > 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>> 
>>
>>  >
>>  >  >
>>  > 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>>
>>  > 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
>> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>>). 
>>
>>  >
>>  >  >
>>  >  >  >  I'm a bit concerned that I'm going to have to resort to raw 
>> SQL.
>>  >  >  >
>>  >  >  > Thanks,
>>  >  >  >
>>  >  >  > Phil
>>  >  >  >
>>  >  >  > Phil Warrick wrote:
>>  >  >  >
>>  >  >  >> Hi all,
>>  >  >  >>
>>  >  >  >> I was wondering if someone could write up something to explain
>>  > the use
>>  >  >  >> of subqueries.  I'm deciphering the relevant PB test cases 
>> at the
>>  >  >  >> moment and can probably figure it out, but it looks like an
>>  > important
>>  >  >  >> gap in the documentation.
>>  >  >  >>
>>  >  >  >> Thanks,
>>  >  >  >>
>>  >  >  >> Phil
>>  >  >  >>
>>  >  >  >>
>>  >  >  >
>>  >  >  >
>>  >  >  >
>>  >  >  > 
>> ---------------------------------------------------------------------
>>  >  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>  >  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>  >  >  >
>>  >  >  >
>>  >  >
>>  >  > 
>> ---------------------------------------------------------------------
>>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>>  >  >
>>  >
>>  >
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Query casts [was: subqueries: doc]

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi Jakob,

I have concluded that the missing feature here is an OQL-style cast (to 
downcast the C to a D).  In your opinion, would adding this feature 
involve a major refactoring or could it be a straightforward addition to 
the PB-api?

Thanks,

Phil



Philip Warrick wrote:
> Hi again,
> 
> A small clarification, the query that I'd like to do is a little more
> complicated:
> find all A's with aAttribute = "foo" and having a D with
> dAttribute = "bar" and a C with cAttribute = "foobar".
> 
> My original query could be achieved efficiently by searching for the D's
> with the two criteria:
> d.b.a.aAttribute = "foo" AND
> d.dAttribute = "bar"
> 
> and then navigating to the A object(s) which should be cached.
> 
> Phil
> 
>  > Hi Jakob,
>  >
>  > Thanks for this writeup.
>  >
>  > Here's an example of a query that I'd like to perform:
>  >
>  > A-1------M-B-1------M-C
>  >                        |
>  >                        /\
>  >                        --
>  >                         |
>  >                         D
>  >
>  > i.e. A has a 1-M association with B, B has a 1-M association with C and
>  > D is one subclass of C
>  >
>  > I'd like to query for all A's with aAttribute = "foo" having a D with
>  > dAttribute = "bar".
>  >
>  > Obviously I cannot use a criteria like "a.b.c.dAttribute".
>  >
>  > I can query for all the D's first, then iterate through the
>  > corresponding A's and check for the aAttribute, but I'd like to do this
>  > in one query (and let the dbms do most of the work).
>  >
>  > Sounds like a job for a subquery, but I am not sure if I can do this
>  > with PB queries and subqueries.  Can anyone help?
>  >
>  > Phil
>  >
>  >
>  > Jakob Braeuchi wrote:
>  >  > hi phil,
>  >  >
>  >  > i added a small docu to query.xml
>  >  >
>  >  > jakob
>  >  >
>  >  > Phil Warrick wrote:
>  >  >
>  >  >  > Hi again,
>  >  >  >
>  >  >  > I came across some discussions with Jakob from last Sept. about
>  > allowing
>  >  >  > references to parents in subqueries.  Did anything come of this?
>  >  >  >
>  >  >  > The reason I'm asking is that after six months of using OJB in
>  >  >  > production to get data into the system (ojb has been rock solid!)
>  > it's
>  >  >  > time for many, many complex queries to get data out (similar to
>  > Oliver
>  >  >  > Matz's queries:
>  >  >  >
>  >  >
>  > 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
> 
>  > 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>> 
> 
>  >
>  >  >
>  > 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> 
>  > 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>>). 
> 
>  >
>  >  >
>  >  >  >  I'm a bit concerned that I'm going to have to resort to raw SQL.
>  >  >  >
>  >  >  > Thanks,
>  >  >  >
>  >  >  > Phil
>  >  >  >
>  >  >  > Phil Warrick wrote:
>  >  >  >
>  >  >  >> Hi all,
>  >  >  >>
>  >  >  >> I was wondering if someone could write up something to explain
>  > the use
>  >  >  >> of subqueries.  I'm deciphering the relevant PB test cases at the
>  >  >  >> moment and can probably figure it out, but it looks like an
>  > important
>  >  >  >> gap in the documentation.
>  >  >  >>
>  >  >  >> Thanks,
>  >  >  >>
>  >  >  >> Phil
>  >  >  >>
>  >  >  >>
>  >  >  >
>  >  >  >
>  >  >  >
>  >  >  > 
> ---------------------------------------------------------------------
>  >  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  >  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >  >  >
>  >  >  >
>  >  >
>  >  > ---------------------------------------------------------------------
>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >  >
>  >
>  >
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: subqueries: doc

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi again,

A small clarification, the query that I'd like to do is a little more 
complicated:
find all A's with aAttribute = "foo" and having a D with
dAttribute = "bar" and a C with cAttribute = "foobar".

My original query could be achieved efficiently by searching for the D's 
with the two criteria:
d.b.a.aAttribute = "foo" AND
d.dAttribute = "bar"

and then navigating to the A object(s) which should be cached.

Phil

> Hi Jakob,
> 
> Thanks for this writeup.
> 
> Here's an example of a query that I'd like to perform:
> 
> A-1------M-B-1------M-C
>                        |
>                        /\
>                        --
>                         |
>                         D
> 
> i.e. A has a 1-M association with B, B has a 1-M association with C and
> D is one subclass of C
> 
> I'd like to query for all A's with aAttribute = "foo" having a D with
> dAttribute = "bar".
> 
> Obviously I cannot use a criteria like "a.b.c.dAttribute".
> 
> I can query for all the D's first, then iterate through the
> corresponding A's and check for the aAttribute, but I'd like to do this
> in one query (and let the dbms do most of the work).
> 
> Sounds like a job for a subquery, but I am not sure if I can do this
> with PB queries and subqueries.  Can anyone help?
> 
> Phil
> 
> 
> Jakob Braeuchi wrote:
>  > hi phil,
>  >
>  > i added a small docu to query.xml
>  >
>  > jakob
>  >
>  > Phil Warrick wrote:
>  >
>  >  > Hi again,
>  >  >
>  >  > I came across some discussions with Jakob from last Sept. about 
> allowing
>  >  > references to parents in subqueries.  Did anything come of this?
>  >  >
>  >  > The reason I'm asking is that after six months of using OJB in
>  >  > production to get data into the system (ojb has been rock solid!) 
> it's
>  >  > time for many, many complex queries to get data out (similar to 
> Oliver
>  >  > Matz's queries:
>  >  >
>  > 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213> 
> 
>  > 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>>). 
> 
>  >
>  >  >  I'm a bit concerned that I'm going to have to resort to raw SQL.
>  >  >
>  >  > Thanks,
>  >  >
>  >  > Phil
>  >  >
>  >  > Phil Warrick wrote:
>  >  >
>  >  >> Hi all,
>  >  >>
>  >  >> I was wondering if someone could write up something to explain 
> the use
>  >  >> of subqueries.  I'm deciphering the relevant PB test cases at the
>  >  >> moment and can probably figure it out, but it looks like an 
> important
>  >  >> gap in the documentation.
>  >  >>
>  >  >> Thanks,
>  >  >>
>  >  >> Phil
>  >  >>
>  >  >>
>  >  >
>  >  >
>  >  >
>  >  > ---------------------------------------------------------------------
>  >  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  >  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >  >
>  >  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: subqueries: doc

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi Jakob,

Thanks for this writeup.

Here's an example of a query that I'd like to perform:

A-1------M-B-1------M-C
                       |
                       /\
                       --
                        |
                        D

i.e. A has a 1-M association with B, B has a 1-M association with C and 
D is one subclass of C

I'd like to query for all A's with aAttribute = "foo" having a D with 
dAttribute = "bar".

Obviously I cannot use a criteria like "a.b.c.dAttribute".

I can query for all the D's first, then iterate through the 
corresponding A's and check for the aAttribute, but I'd like to do this 
in one query (and let the dbms do most of the work).

Sounds like a job for a subquery, but I am not sure if I can do this 
with PB queries and subqueries.  Can anyone help?

Phil


Jakob Braeuchi wrote:
> hi phil,
> 
> i added a small docu to query.xml
> 
> jakob
> 
> Phil Warrick wrote:
> 
>  > Hi again,
>  >
>  > I came across some discussions with Jakob from last Sept. about allowing
>  > references to parents in subqueries.  Did anything come of this?
>  >
>  > The reason I'm asking is that after six months of using OJB in
>  > production to get data into the system (ojb has been rock solid!) it's
>  > time for many, many complex queries to get data out (similar to Oliver
>  > Matz's queries:
>  > 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213 
> <http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213>). 
> 
>  >  I'm a bit concerned that I'm going to have to resort to raw SQL.
>  >
>  > Thanks,
>  >
>  > Phil
>  >
>  > Phil Warrick wrote:
>  >
>  >> Hi all,
>  >>
>  >> I was wondering if someone could write up something to explain the use
>  >> of subqueries.  I'm deciphering the relevant PB test cases at the
>  >> moment and can probably figure it out, but it looks like an important
>  >> gap in the documentation.
>  >>
>  >> Thanks,
>  >>
>  >> Phil
>  >>
>  >>
>  >
>  >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>  > For additional commands, e-mail: ojb-user-help@db.apache.org
>  >
>  >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: subqueries: doc

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi phil,

i added a small docu to query.xml

jakob

Phil Warrick wrote:

> Hi again,
> 
> I came across some discussions with Jakob from last Sept. about allowing 
> references to parents in subqueries.  Did anything come of this?
> 
> The reason I'm asking is that after six months of using OJB in 
> production to get data into the system (ojb has been rock solid!) it's 
> time for many, many complex queries to get data out (similar to Oliver 
> Matz's queries: 
> http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213). 
>  I'm a bit concerned that I'm going to have to resort to raw SQL.
> 
> Thanks,
> 
> Phil
> 
> Phil Warrick wrote:
> 
>> Hi all,
>>
>> I was wondering if someone could write up something to explain the use 
>> of subqueries.  I'm deciphering the relevant PB test cases at the 
>> moment and can probably figure it out, but it looks like an important 
>> gap in the documentation.
>>
>> Thanks,
>>
>> Phil
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: subqueries: doc

Posted by Phil Warrick <ph...@mcgill.ca>.
Hi again,

I came across some discussions with Jakob from last Sept. about allowing 
references to parents in subqueries.  Did anything come of this?

The reason I'm asking is that after six months of using OJB in 
production to get data into the system (ojb has been rock solid!) it's 
time for many, many complex queries to get data out (similar to Oliver 
Matz's queries: 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgId=1005213). 
  I'm a bit concerned that I'm going to have to resort to raw SQL.

Thanks,

Phil

Phil Warrick wrote:
> Hi all,
> 
> I was wondering if someone could write up something to explain the use 
> of subqueries.  I'm deciphering the relevant PB test cases at the moment 
> and can probably figure it out, but it looks like an important gap in 
> the documentation.
> 
> Thanks,
> 
> Phil
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org