Bugs item #638488, was opened at 2002-11-14 08:14
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=638488&group_id=22866

Category: JBossCMP
Group: CVS HEAD
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jeremy Boynes (jboynes)
>Assigned to: Jeremy Boynes (jboynes)
Summary: Incorrect SQL with OR and IS NOT EMPTY

Initial Comment:
Opening this as 621270 has been closed.

Incorrect SQL is generated for EJB-QL where IS NOT
EMPTY is used in a OR condition such as:
SELECT OBJECT(p) 
FROM parent p 
WHERE p.children IS NOT EMPTY 
        OR p.value = ?1

generates

SELECT t0_p.id 
FROM Parent t0_p, Child t1_p_children 
WHERE ((1=1) OR t0_p.value = ?)  -- <---- oops
AND (t0_p.id=t1_p_children.parent)

----------------------------------------------------------------------

>Comment By: Jeremy Boynes (jboynes)
Date: 2003-01-07 20:50

Message:
Logged In: YES 
user_id=378919

Fixed in Branch_3_2 and HEAD
Now provided the database supports subqueries they will
always be used.

If the database does not (e.g. MySQL), then a query like:

SELECT DISTINCT Parent.ID
FROM Parent 
LEFT JOIN Child ON (Parent.ID = Child.Parent)
WHERE Child.ID IS NOT NULL
OR Parent.value = ?

will be generated. This takes a performance hit but
generates correct results except if the query is meant to
return duplicate values - SQL requires subqueries to handle
that.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=638488&group_id=22866


-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to