You have to pass dates as a parameter to the query.
Instead of real dates put in the query ?1, ?2, ...
And then ejbSelectMethod(jbossQl.toString(), args), where args
contains instances of Date.

alex

Tuesday, April 01, 2003, 2:17:15 PM, Brijesh Sood wrote:

BS> Hi All   , I have to create dynamicql that will take two java.sql.Date and find 
the specified values between those dates. I m using BETWEEN operator to check the date 
range. as the  date values i
BS> m passing are appended to ql being generated when i m 
BS> this is like
BS> jBossQL.append(" AND P.forecastCloseDate BETWEEN 
'"+(java.sql.Date)searchKeys.get("forcastCloseStartDate")+"' AND 
'"+(java.sql.Date)searchKeys.get("forcastCloseEndDate")+"'");

BS> With that i m certain other search criteria this is working perfectly .
BS> I m giving date value in single quotes as " ' 
"+(java.sql.Date)searchKeys.get("forcastCloseStartDate") +" ' "

BS> In the error log it is printing ql generated ...

BS> SELECT DISTINCT OBJECT(P) FROM Prospect As P , IN ( P.prospectService) As PS  
WHERE P.forecastCloseDate BETWEEN '2003-02-0
BS> 1 00:00:00' AND '2003-04-01 00:00:00' ORDER BY P.prospectID

BS> JBOSS giving exception on execution

BS> 16:42:08,520 INFO  [STDOUT] Finder exception in getProspectBySearchCriteria 
javax.ejb.FinderException: Error compiling ejbql: org.jboss.ejb.plu
BS> gins.cmp.ejbql.ParseException: Encountered "\'2003-02-01 00:00:00\'" at line 1, 
column 134.
BS> Was expecting one of:
BS>     <DATETIME_VALUED_PARAMETER> ...
BS>     <DATETIME_VALUED_PATH> ...


BS> This is second case when i m not using single quota to enclose the date values

BS> jBossQL.append(" AND P.forecastCloseDate BETWEEN 
"+(java.sql.Date)searchKeys.get("forcastCloseStartDate")+" AND 
"+(java.sql.Date)searchKeys.get("forcastCloseEndDate"));
BS> SELECT DISTINCT OBJECT(P) FROM Prospect As P , IN ( P.prospectService) As PS  
WHERE P.prospectID > 0 AND P.forecastCloseDate BETWEEN 2002-04-01 00:00:00 AND 
2003-04-01 00:00:00 ORDER BY
BS> P.prospectID

BS> 16:48:45,912 INFO  [STDOUT] Finder exception in getProspectBySearchCriteria 
javax.ejb.FinderException: Error compiling ejbql: org.jboss.ejb.plu
BS> gins.cmp.ejbql.ParseException: Encountered "2002" at line 1, column 134.
BS> Was expecting one of:
BS>     <DATETIME_VALUED_PARAMETER> ...
BS>     <DATETIME_VALUED_PATH> ...

BS> Anyone can help ???????????
BS> Rgds
BS> Brijesh




-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to