persistence@glassfish.java.net

RE: Workaround for Showstopper needed

From: Markus Karg <karg_at_quipsy.de>
Date: Wed, 18 Jun 2008 08:46:08 +0200

Thank you, Tom and James.

The proposed left outer join works very well. Silly me! Once more it was my fault:

According to EJB 3.0 Persistence Specification chapter 4.4.4 "Path Expressions" paragraph 3, this is not a bug:

"Path expression navigability is composed using "inner join" semantics. That is, if the value of a non-terminal association-field in the path expression is null, the path is considered to have no value, and does not participate in the determination of the result."

So I have reduced the priority from P2 to P5 and propose that this bug report is REJECTED / CLOSED since it is INVALID.

Please close the bug report. Shame one me. ;-)

Thanks a lot for your kind and fast help! The support of the TopLink team is really great! :-)
Markus

-----Original Message-----
From: Tom Ware [mailto:tom.ware_at_oracle.com]
Sent: Dienstag, 17. Juni 2008 16:27
To: persistence_at_glassfish.dev.java.net
Subject: Re: Workaround for Showstopper needed

Hi Markus,

   I am not sure this is a bug due to the fact that the spec defines the "."s in
your expressions as inner joins, but lets leave that debate until we can get
your code working.

   What results do you expect to see? Specifically, what SQL would you write to
get the results you want to see?

   Have you tried using including an outer join in the from clause... Something
like:

SELECT DISTINCT a FROM A a LEFT JOIN a.fb f WHERE (1=1) OR (f.cb=?1)

-Tom

Markus Karg wrote:
> I want to ask if somebody knows a workaround for this bug:
>
>
>
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=5171
>
>
>
> I have written the following query:
>
>
>
> SELECT DISTINCT a FROM A a WHERE (1=1) OR (a.fb.cb=?1)
>
>
>
> Obviously the WHERE clause is "TRUE OR ...", so it should always return
> ALL values.
>
>
>
> Actually, if a.fb contains NULL, then that row is mssing in the result set.
>
>
>
> For me, TRUE OR NullPointerException should be still TRUE, since this is the
>
> core idea of the OR statement. But it seems as if TopLink handles it
>
> differently: "TRUE OR anything is TRUE until 'anything' is a
> NullPointerException".
>
>
>
> (Actually the 1=1 is only a simulation to provoke and demonstrate the buggy
>
> behaviour. Certainly the real query we are running is much more complex
> and does
>
> not include a static 1=1 comparison. We just wrote 1=1 to demonstrate
> that the
>
> OR is behaving very strange in case of NullPointerException).
>
>
>
> This is very problematic, since we need to run queries of the form "If
> there is
>
> an object referenced, check some fields of that object. If no object is
> linked,
>
> just take the row as it is."
>
>
>
> Since we do not see any workaround, this is an absolute showblocker for us.
>
>
>
> Thanks a lot! :-)
>
> Markus
>
>
>
> QUIPSY QUALITY GmbH & Co. KG
>
> Ein Unternehmen der MES-Gruppe
>
> Stuttgarter Strasse 23
>
> D-75179 Pforzheim
>
> Tel: 07231-9189-52
>
> Fax: 07231-9189-59
>
> www.quipsy.de <http://www.quipsy.de>
>
> karg_at_quipsy.de <mailto:karg_at_quipsy.de>
>
> Registergericht Mannheim HRA 701214
>
> Geschäftsführer: Nils Schroeder
>
>
>
> Diese E-Mail enthält persönliche, vertrauliche und vor Weitergabe
> geschützte Informationen und ist ausschließlich für den vorgesehenen
> o.g. Empfänger (Adressaten) bestimmt. Falls Sie diese E-Mail
> versehentlich erhalten haben und nicht der vorgesehene Empfänger sind,
> bitten wir Sie, die E-Mail und deren Anhänge nicht aufzubewahren, nicht
> zu vervielfältigen, nicht zu nutzen und nicht weiterzugeben. Bitte
> informieren Sie uns als Absender über diesen Zustellungsfehler und
> löschen Sie die E-Mail.
>
>
>