Bugs item #621270, was opened at 2002-10-10 15:07
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=621270&group_id=22866

Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Open
Resolution: None
Priority: 8
Submitted By: Alexei Yudichev (sflexus)
Assigned to: Nobody/Anonymous (nobody)
Summary: invalid SQL is generated for MSSQL

Initial Comment:
I have the following EJBQL expression:

SELECT 
DISTINCT OBJECT(c) FROM StoreCategory c, IN (c.locales) l 
WHERE l.code=?1 AND c.images IS NOT EMPTY

which 
for postgresql translates into:

Executing SQL: SELECT 
DISTINCT t0_c.id FROM storecategory t0_c, mmslocale t1_l, 
storecategory_locales_m_18q3els 
t2_c_locales_RELATION_TABLE, mmsimage t3_c_images, 
mmsimage_storecategorie_1diogue 
t4_c_images_RELATION_TABLE WHERE (t1_l.code = ? AND 
TRUE) AND 
(t0_c.id=t4_c_images_RELATION_TABLE.StoreCategory 
AND 
t3_c_images.id=t4_c_images_RELATION_TABLE.MMSImage 
AND 
t0_c.id=t2_c_locales_RELATION_TABLE.StoreCategory 
AND 
t1_l.code=t2_c_locales_RELATION_TABLE.MMSLocale)

and 
executes normally.

But for MSSQL I get:

SELECT 
DISTINCT t0_c.id FROM StoreCategory t0_c, MMSLocale t1_l, 
StoreCategory_locales_MMSLocale_storeCategories 
t2_c_locales_RELATION_TABLE, MMSImage t3_c_images, 
MMSImage_storeCategories_StoreCategory_images 
t4_c_images_RELATION_TABLE WHERE (t1_l.code = ? AND 
1) AND 
(t0_c.id=t4_c_images_RELATION_TABLE.StoreCategory 
AND 
t3_c_images.id=t4_c_images_RELATION_TABLE.MMSImage 
AND 
t0_c.id=t2_c_locales_RELATION_TABLE.StoreCategory 
AND 
t1_l.code=t2_c_locales_RELATION_TABLE.MMSLocale)

which 
leads to 
java.sql.SQLException: [Microsoft][SQLServer 
2000 Driver for JDBC][SQLServer]Line 1: Incorrect syntax near 
')'.

Why not using "AND 1=1" instead of "AND 1"?

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

>Comment By: Alexey Loubyansky (loubyansky)
Date: 2002-10-11 11:20

Message:
Logged In: YES 
user_id=543482

If I got you right, it's the problem with true-mapping.
Currently, for MS SQLSERVER:
         <true-mapping>1</true-mapping>
         <false-mapping>0</false-mapping>
I am not familiar with MS SQLSERVER but if you are sure it 
should be
         <true-mapping>(1=1)</true-mapping>
         <false-mapping>(1=0)</false-mapping>
like for Hypersonic, I'll fix it.

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

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


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to