db-ojb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Warrick <warr...@bmed.mcgill.ca>
Subject Re: OQL query help: need PB api?
Date Thu, 06 Feb 2003 19:01:37 GMT
Hi Jakob,

Can you navigate a 1-M association directly in a query?  The C-B and B-F 
associations are 1-M, so isn't it ambiguous to navigate them?  Thus the 
need to start from A?  I believe this is how it is done with OQL in 
these cases.

Phil

Jakob Braeuchi wrote:
> hi phil,
> 
> you select from A so ojb will return A:
> 
>  >> select a.b.c from " + A.class.getName()
> 
> if you're interested in C you'l have to modify your query  and adapt the 
> criteria:
> 
> select from C where b.f.d.e = 'foo'  (what a join !)
> 
> or you read your A and the navigate to C.
> 
> hth
> jakob
> 
> 
> Phil Warrick wrote:
> 
>> Matthew,
>>
>> A quick-and-dirty class diagram:
>>
>> C 1<----->M B 1<----->M F M----->1 D
>>                         |
>>                         | (inheritance)
>>                         |
>>                         A
>>
>> The arrows indicate navagability; multiplicity indicated by 1 or M.  A 
>> inherits from F.  e is a String attribute of D.
>>
>> Don't have the mapping handy, but can send later.
>>
>> Perhaps this could be translated into the equivalent using test case 
>> classes for easier discussion?
>>
>> Phil
>>
>>
>> Matthew Baird wrote:
>>
>>> so, just so I'm clear on this...
>>>  
>>> are C and A related? is one the extent of the other? How are they 
>>> mapped?
>>>  
>>> in the select a.b.c, are those attributes, or what?
>>>  
>>> need more information
>>>
>>>     -----Original Message-----     From: Phil Warrick 
>>> [mailto:warrick@bmed.mcgill.ca]     Sent: Thu 2/6/2003 4:44 AM     
>>> To: OJB Users List     Cc:     Subject: Re: OQL query help: need PB api?
>>>        
>>>     Hi Matthew et al.,
>>>         It seems that this returns class A objects, not the class C 
>>> objects I'm
>>>     after.  Is there something else to do?  Can this be done with the 
>>> PB api?
>>>         Thanks,
>>>         Phil
>>>         Matthew Baird wrote:
>>>     > you can do this.
>>>     >     > try binding your parameters, however
>>>     >     > select ... where a.d.e =$1
>>>     >     > then
>>>     >     > query.bind("foo");
>>>     >
>>>     >       -----Original Message-----
>>>     >       From: Phil Warrick [mailto:warrick@bmed.mcgill.ca]
>>>     >       Sent: Tue 2/4/2003 7:20 PM
>>>     >       To: OJB Users List
>>>     >       Cc:
>>>     >       Subject: OQL query help: need PB api?
>>>     >          >          >
>>>     >       Hi,
>>>     >          >       I've been able to do all my queries with OQL 
>>> so far, but I think I need
>>>     >       to drop down to the PB API for the following (valid OQL) 
>>> query:
>>>     >          >       "select a.b.c from " + A.class.getName() +
>>>     >       + " where a.d.e = \"foo\" "
>>>     >          >       (i.e. I want to return objects of the same 
>>> class as the c reference:
>>>     >       let's call them class C objects.)
>>>     >          >       Firstly, am I right that I can't do this with 
>>> OJB's OQL?  Second, can I
>>>     >       do this with the PB?  Could someone take a crack at what 
>>> it would look like?
>>>     >          >       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



Mime
View raw message