db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Baird" <Matthew.Ba...@motiva.com>
Subject RE: odmg unit test error: OQLOrOnForeignKeyTest.testOrReferenceOnSameTable()
Date Thu, 06 Feb 2003 18:07:58 GMT
sorry, just caught up on this thread.

I wrote this test case to illustrate a problem with OJB. I noted this in the test comments.

I think we need to fix it so that OJB is smart enough to realize that it should use the outer
join, or NO join since the query is based on the primary key anyway.

Jakob, aren't you the sql generation expert :)

I don't think we should write a work-around to this, as it is a legitimate problem

regards,
Matthew

-----Original Message-----
From: Jakob Braeuchi [mailto:jbraeuchi@gmx.ch]
Sent: Thursday, February 06, 2003 10:03 AM
To: OJB Developers List
Subject: Re: odmg unit test error:
OQLOrOnForeignKeyTest.testOrReferenceOnSameTable()


hi david,

this is imho a problem with the joins:

we have 'jimmy'  with mother_id = 12
and 'joe' with father_id = 13
and 'mom' and 'dad'.

the query executed is as follows:

SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID
FROM FAMILY_MEMBER A0
INNER JOIN FAMILY_MEMBER A1 ON A0.MOTHER_ID=A1.ID
INNER JOIN FAMILY_MEMBER A2 ON A0.FATHER_ID=A2.ID
WHERE A1.ID =  '12'  OR  A2.ID =  '13'

because of the inner joins there's no record returned.
when changing the sql to outer joins 'jimmy' and 'joe' are returned as 
expected.

SELECT A0.FATHER_ID,A0.MOTHER_ID,A0.LASTNAME,A0.FIRSTNAME,A0.ID
FROM FAMILY_MEMBER A0
LEFT OUTER JOIN FAMILY_MEMBER A1 ON A0.MOTHER_ID=A1.ID
LEFT OUTER JOIN FAMILY_MEMBER A2 ON A0.FATHER_ID=A2.ID
WHERE A1.ID =  '12'  OR  A2.ID =  '13'

i'll check this one with pb api.

thanks
jakob

David Warnock wrote:

> Hi,
>
> I have just cvs updated and now the PersistanceBrokerTest.testEscaping 
> is working. But I get a failure in
>
> org.apache.ojb.odmg.OQLOrOnForeignKeyTest.testOrReferenceOnSameTable()
>
> Testcase: testOrReferenceOnSameTable took 0.04 sec
>         FAILED
> expected:<2> but was:<0>
> junit.framework.AssertionFailedError: expected:<2> but was:<0>
>         at 
> org.apache.ojb.odmg.OQLOrOnForeignKeyTest.testOrReferenceOnSameTable(OQLOrOnForeignKeyTest.java:191)

>
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

>
>
> Testcase: testOrReferenceOnSameTableTestcase: 
> testOrReferenceOnDifferentTables took 0.023 sec
>
> Anyone looking at this already or am I doing something wrong?
>
> Thanks
>
> Dave



---------------------------------------------------------------------
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