-
1. Re: EJB QL and In expression
davidjencks Nov 23, 2001 12:51 AM (in response to htaepper)Can you do this in plain oracle sql?? I never could get anything resembling this to work.
Try
o.Pk = ?1 or o.Pk = ?2 or ... -
2. Re: EJB QL and In expression
htaepper Dec 3, 2001 5:56 AM (in response to htaepper)In plain Oracle you can use an IN-clause. You also can use an IN-clause whith JDBC on various Databases i. e. ORACLE, MS-SQL, MS-ACCESS. Whith a testversion of BEA Weblogic 6.1 it works fine too.
As a workaround the suggestion of an joined query by OR will work. Thanks. -
3. Re: EJB QL and In expression
dsundstrom Dec 3, 2001 1:19 PM (in response to htaepper)What sql is the engine generating? If you turn on debugging in the jbosscmp-jdbc.xml file, JBossCMP will log (debug) the sql generated from the EJB-QL.
-dain -
4. Re: EJB QL and In expression
htaepper Dec 5, 2001 6:14 AM (in response to htaepper)The log file contains following entries:
[2001-12-05 12:04:51,248,CMP,DEBUG] EQL-QL: SELECT OBJECT(o) FROM Fir o WHERE o.pk in ( ?1, ?2 , ?3 , ?4 , ?5 ,?6 ,?7 ,?8 ,?9 ,?10 )
[2001-12-05 12:04:51,418,CMP,DEBUG] Assembly: []SELECT/OBJECT/(/o/)/FROM/Fir/o^WHERE/o/./pk/in/(/?1/,/?2/,/?3/,/?4/,/?5/,/?6/,/?7/,/?8/,/?9/,/?10/)
[2001-12-05 12:04:51,418,CMP,DEBUG] findByKeys SQL: SELECT t1_o.pk FROM Fir t1_o
...
[2001-12-05 11:39:46,068,CMP,DEBUG] findByKeys command executing: SELECT t1_o.pk FROM Fir t1_o
[2001-12-05 11:39:46,068,CMP,DEBUG] Get result: index=1, javaType=java.lang.String, S value=1006954324229Fir-6878221951898700712
[2001-12-05 11:39:46,068,CMP,DEBUG] Get result: index=1, javaType=java.lang.String, S value=1006954354192Fir3300652343385115741
[2001-12-05 11:39:46,068,CMP,DEBUG] Get result: index=1, javaType=java.lang.String, S value=1006954394095Fir-3951422115451076574
[2001-12-05 11:39:46,068,CMP,DEBUG] Get result: index=1, javaType=java.lang.String, S value=1006954452113Fir2256422688763234438
Changing to the or-clause creates following :
[2001-12-05 11:58:13,772,CMP,DEBUG] EQL-QL: SELECT OBJECT(o) FROM Fir o WHERE o.pk = ?1 or o.pk = ?2 or o.pk =?3 or o.pk =?4 or o.pk =?5 or o.pk =?6 or o.pk =?7 or o.pk =?8 or o.pk =?9 or o.pk =?10
[2001-12-05 11:58:14,533,CMP,DEBUG] Assembly: []SELECT/OBJECT/(/o/)/FROM/Fir/o/WHERE/o/./pk/=/?1/or/o/./pk/=/?2/or/o/./pk/=/?3/or/o/./pk/=/?4/or/o/./pk/=/?5/or/o/./pk/=/?6/or/o/./pk/=/?7/or/o/./pk/=/?8/or/o/./pk/=/?9/or/o/./pk/=/?10^
[2001-12-05 11:58:14,533,CMP,DEBUG] findByKeys SQL: SELECT t1_o.pk FROM Fir t1_o WHERE t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? or t1_o.pk = ? -
5. Re: EJB QL and In expression
dsundstrom Dec 5, 2001 4:37 PM (in response to htaepper)Ok, this is obviously a bug. I'll look into it.
-
6. Re: EJB QL and In expression
dsundstrom Dec 6, 2001 4:51 PM (in response to htaepper)Can you post a bug report at sourceforge?