-
1. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
hunterhillegas Feb 27, 2002 1:43 AM (in response to dsundstrom)So far the new stuff is working great for me. Thanks Dain.
-
2. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
sheepe Feb 27, 2002 7:17 AM (in response to dsundstrom)Hmm.. it must be my code, but anyway. These EJB-QL queries used to work before, and they stopped doing so:
SELECT OBJECT(c) FROM Category C WHERE C = ?1
SELECT OBJECT(p) FROM Product AS p WHERE ?1 MEMBER OF p.categories
The new parser says it was expecting something other than '?1'.. What's the problem here?
tia,
Christopher -
3. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
dsundstrom Feb 27, 2002 10:31 AM (in response to dsundstrom)Can you give the exact error message (not the stack trace) and the parameter types?
-
4. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
sheepe Feb 27, 2002 11:43 AM (in response to dsundstrom)Query:
SELECT OBJECT(p) FROM Product AS p WHERE ?1 MEMBER OF p.categories
Parameter: new Integer(1) - for example
Error message:
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable is: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "1" at line 1, column 42.
Was expecting one of:
"NOT" ...
<IDENTIFICATION_VARIABLE> ...
<ENTITY_VALUED_PARAMETER> ...
<ENTITY_VALUED_PATH> ...
<COLLECTION_VALUED_PATH> ...
"(" ...
<STRING_VALUED_PATH> ...
"CONCAT" ...
"SUBSTRING" ...
<BOOLEAN_VALUED_PATH> ...
<DATETIME_VALUED_PATH> ...
<NUMERIC_VALUED_PATH> ...
"LENGTH" ...
"LOCATE" ...
"ABS" ...
"SQRT" ...
"+" ...
"-" ...
<INTEGER_LITERAL> ...
<FLOATING_POINT_LITERAL> ...
<NUMERIC_VALUED_PARAMETER> ... -
5. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
dsundstrom Feb 27, 2002 12:37 PM (in response to dsundstrom)The problem is you are trying to determine if an NumericValuedParameter is a member of an EntityCollection. Change your parameter type to Category.
I tested the following query:SELECT OBJECT(p) FROM Product AS p WHERE ?1 NOT MEMBER OF p.productCategories
BTW, you helped me find a different bug with parameter indexes in MEMBER OF were being pased a base-one (the system expects base-zero internally). -
6. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
pazu Feb 27, 2002 2:35 PM (in response to dsundstrom)Would you please, pleas add the possibility to use parameters in LIKE clauses to JBoss-QL? So we can do something like
SELECT OBJECT(o) From Entity o WHERE o.field LIKE ?1
and ?1 would contain % and the like (pun intended). -
7. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
dsundstrom Feb 27, 2002 3:05 PM (in response to dsundstrom)Please, post this undet the "JBossQL feature requests" topic.
-
8. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
henniges Feb 27, 2002 5:33 PM (in response to dsundstrom)Regarding the J2EE tutorial at sun (http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBQL4.html) the following EJB-QL should work:
SELECT DISTINCT OBJECT(p)
FROM Player p, IN (p.teams) AS t
WHERE t.league = ?1
So why does the following EJB-QL not work?
SELECT OBJECT(b) FROM Ber b, IN (b.pers) AS p
WHERE p.name = ?1
server.log:
2002-02-27 23:18:34,193 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Ber.findByName] EJB-QL: SELECT OBJECT(b) FROM Ber b, IN (b.pers) AS p WHERE p.name = ?1
2002-02-27 23:18:34,603 ERROR [org.jboss.ejb.EntityContainer] Exception in service lifecyle operation: start
org.jboss.deployment.DeploymentException: Error compiling ejbql; - nested throwable is: org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "b.pers" at line 1, column 36.
Was expecting:
<COLLECTION_VALUED_PATH> ...
org.jboss.ejb.plugins.cmp.ejbql.ParseException: Encountered "b.pers" at line 1, column 36.
Was expecting:
<COLLECTION_VALUED_PATH> ...
Thanks for help! -
9. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
dsundstrom Feb 27, 2002 9:53 PM (in response to dsundstrom)Read the error message again.
Encountered "b.pers" at line 1, column 36. Was expecting:
<COLLECTION_VALUED_PATH> ...
It means that b.pers is not a collection valued path. -
10. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
jasonuithol Mar 18, 2002 6:24 AM (in response to dsundstrom)Hello !
I downloaded the Jboss3.0beta and then saw a post regarding the new EJB-QL parser, which I would love to have !!
Is there an easy "patch" method to the beta so that I can just pop in the new parser ? NOTE: I don't have the source for the beta. -
11. Re: New EJB-QL compiler (ORDER BY and DynamicQL)
jasonuithol Mar 18, 2002 6:40 AM (in response to dsundstrom)I might just add that if getting the source and rebuilding from it would make life easier, I will endeavour to do so.
Some instructions for getting the source for the beta would be greatly appreciated if that is the case...
Jason Uithol.
P.S. Great system guys ! -
12. Casting INTEGER_VALUED_PATH to String ???
jasonuithol Mar 18, 2002 11:00 PM (in response to dsundstrom)Hello Dain,
I CVSed the latest source and built it. It contains the new EJB-QL parser. I am now having string/integer casting problems.
- - - - - - - - - - - - - - - - - - - - - - - - - - -
I have an EJB-QL expression:
STRING_VALUED_PATH = INTEGER_VALUED_PATH
Now, so far - I have not been able to get any variants to match any productions, e.g. CONCAT etc.
Is is possible to compare a string to an integer ????
Jason. -
13. Re: Casting INTEGER_VALUED_PATH to String ???
dsundstrom Mar 19, 2002 12:46 PM (in response to dsundstrom)Just for the archives, this was answered on the jboss-user list. EJB-QL only allows the comparison of like types.
-
14. Re: Casting INTEGER_VALUED_PATH to String ???
liuqiang_home Sep 26, 2002 7:42 PM (in response to dsundstrom)Hi! I am using the dynamic-QL plus Order By, I want to do the following:
SELECT OBJECT(g) FROM UserInfo g ORDER BY ?1
I pass the argument as:
Object[] args= new Object[1];
args[0]= "g." + Order; //Order is Column name I pass in
But I got the following error message:
[junit] There was 1 error:
[junit] 1) testIVSSDataLayer_none(com.numeritech.ivss.dataLayer.ivstest)
[junit] javax.ejb.FinderException: Error compiling ejbql: org.jboss.ejb.plugins.cmp.ejbql.ParseE
tion: Encountered "1" at line 1, column 44.
[junit] Was expecting one of:
[junit] <NUMERIC_VALUED_PATH> ...
[junit] <STRING_VALUED_PATH> ...
[junit] <DATETIME_VALUED_PATH> ...
[junit]
[junit] at org.jboss.ejb.plugins.cmp.jdbc.JDBCDynamicQLQuery.execute(JDBCDynamicQLQuery.java
[junit] at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.execute(JDBCSelectorBrid
ava:64)
[junit] at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke(EntityBridg
ocationHandler.java:95)
[junit] at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:59)
_______________________________
it seems Dynamic-QL doesnot support this, am I right? or I did something wrong.
Thanks for reply !