db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: Aliases on MtoN queries not working anymore
Date Sat, 24 Jan 2004 14:09:32 GMT
hi leandro,

i just commited a fix to solve the problem you reported.
the two queries no look like this:

SELECT DISTINCT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON A0,PERSON_PROJECT 
WHERE (PERSON_PROJECT.PROJECT_ID IN ( '2' , '7' )) AND A0.ID = 
PERSON_PROJECT.PERSON_ID


SELECT DISTINCT PERSON_PROJECT.PROJECT_ID,PERSON_PROJECT.PERSON_ID FROM PERSON 
A0,PERSON_PROJECT WHERE (PERSON_PROJECT.PROJECT_ID IN ( '2' , '7' )) AND A0.ID = 
PERSON_PROJECT.PERSON_ID

hth
jakob

Jakob Braeuchi wrote:

> hi leandro,
> 
> i can confirm the problem with the missing alias :(
> 
> the first query (using the alias)loads the related objects :
> 
> SELECT DISTINCT A0.LASTNAME,A0.FIRSTNAME,A0.ID FROM PERSON 
> A0,PERSON_PROJECT WHERE (PERSON_PROJECT.PROJECT_ID IN ( '2' , '7' )) AND 
> A0.ID = PERSON_PROJECT.PERSON_ID
> 
> the second query (alias is missing) retrieves mn-implementors:
> 
> SELECT DISTINCT PROJECT_ID,PERSON_ID FROM PERSON A0,PERSON_PROJECT WHERE 
> (PERSON_PROJECT.PROJECT_ID IN ( '2' , '7' )) AND A0.ID = 
> PERSON_PROJECT.PERSON_ID
> 
> i'll fix it asap.
> 
> jakob
> 
> Leandro Rodrigo Saad Cruz wrote:
> 
>> Ok.. thanks Jakob
>>
>> On Wed, 2004-01-21 at 12:40, "Jakob Bräuchi" wrote:
>>
>>> hi leandro,
>>>
>>> the mn-prefetcher is quite new. and it never supported aliases ;)
>>> i´m at the oop2004 in munich right now; so i´ll have a look at the 
>>> problem
>>> as soon as i´m at home again.
>>>
>>> jakob
>>>
>>>
>>>
>>>> Hi all. I'm having some problems with mton queries because ojb is not
>>>> creating a sql query using aliases anymore.
>>>>
>>>> Maybe the problem is in
>>>> MtoNCollectionPrefetcher.buildMtoNImplementorQuery()
>>>>
>>>> Do you know if the alias generation was accidentally removed ?
>>>>
>>>> Example query(wrong) : SELECT DISTINCT PROJETO_ID,SERVICO_ID FROM
>>>> SERVICO A0,SERVICO_PROJETO WHERE (SERVICO_PROJETO.PROJETO_ID IN ( 
>>>> '12' ,
>>>> '2' , '13' )) AND A0.SERVICO_ID = SERVICO_PROJETO.SERVICO_ID
>>>>
>>>> Causes my database to yeild with :
>>>> org.apache.ojb.broker.PersistenceBrokerSQLException:
>>>> java.sql.SQLException: ERROR:  Column reference "servico_id" is
>>>> ambiguous
>>>>
>>>> Because servico_id is present on both tables, servico and
>>>> servico_projeto
>>>>
>>>> -- 
>>>> Leandro Rodrigo Saad Cruz
>>>> IT - Inter Business Tecnologia e Servicos (IB)
>>>> http://www.ibnetwork.com.br
>>>> http://db.apache.org/ojb
>>>> http://xingu.sourceforge.net
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-dev-help@db.apache.org
>>>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

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


Mime
View raw message