You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br> on 2004/01/20 16:08:36 UTC

Aliases on MtoN queries not working anymore

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


Re: Aliases on MtoN queries not working anymore

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
Excellent ! Thanks Jakob !

--
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e
Serviços (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sf.net


On Sat, 24 Jan 2004 15:09:32 +0100, Jakob Braeuchi <jb...@gmx.ch> escreveu:

> De: Jakob Braeuchi <jb...@gmx.ch>
> Data: Sat, 24 Jan 2004 15:09:32 +0100
> Para: OJB Developers List <oj...@db.apache.org>
> Assunto: Re: Aliases on MtoN queries not working anymore
> 
> 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
> 
> 
> 
> 

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


Re: Aliases on MtoN queries not working anymore

Posted by Jakob Braeuchi <jb...@gmx.ch>.
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


Re: Aliases on MtoN queries not working anymore

Posted by Jakob Braeuchi <jb...@gmx.ch>.
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


Re: Aliases on MtoN queries not working anymore

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
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
> > 
-- 
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


Re: Aliases on MtoN queries not working anymore

Posted by Jakob Bräuchi <jb...@gmx.ch>.
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
> 

-- 
+++ GMX - die erste Adresse für Mail, Message, More +++
Bis 31.1.: TopMail + Digicam für nur 29 EUR http://www.gmx.net/topmail


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