Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with EJB-QL queries  RSS feed

 
reddy ami
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying a EJB-QL for finding, where I want to compare the given date with the dateofpurchase column in the table: Here is my EJB-QL query
SELECT Object (o)
FROM Order o
WHERE (o.dateofpurchase >= ?1)
?1 -> is of java.sql.Date type
dateofpurchase -> is of DATE type in Pointbase 4.2
and the following error as occured when I am trying to test the Entity bean. So I runned verfiier tool, it gave me these failures:
Error: [ SELECT Object (o) FROM Order o WHERE o.dateofpurchase <= ?1 ] has parsing error(s)
Exception occured : [Invalid type for expression (o.dateofpurchase <= ?1)
EJB QL statement : 'SELECT Object (o) FROM Order o WHERE o.dateofpurchase <= ?1'
EJB QL method : public abstract java.util.Collection EntityBeans.OrderHome.findByBeforeDate(java.sql.Date) throws java.rmi.RemoteException,javax.ejb.FinderException
]
Error: [ SELECT Object (o) FROM Order o WHERE o.dateofpurchase >= ?1 ] has parsing error(s)
Exception occured : [Invalid type for expression (o.dateofpurchase >= ?1)
EJB QL statement : 'SELECT Object (o) FROM Order o WHERE o.dateofpurchase >= ?1'
EJB QL method : public abstract java.util.Collection EntityBeans.OrderHome.findByAfterDate(java.sql.Date) throws java.rmi.RemoteException,javax.ejb.FinderException
]
When I trying to use the follwing query, it gave these errors:
SELECT Object (o)
FROM Order o
WHERE (LOCATE (?1, o.isbn) > 0) AND (o.status = ?2)
If Iam using the AND operator it is the problem, other wise it is running perfectly with one single condition.

Error: [ SELECT Object (o) FROM Order o WHERE (LOCATE (?1, o.isbn) > 0) AND ( o.status = ?2) ] has parsing error(s)
Exception occured : [Encountered "LOCATE ( ?1 , o . isbn" at line 1, column 8.
Was expecting one of:
"(" ...
"NOT" ...
"+" ...
"-" ...
"IdentificationVar" ...
<CHAR_LITERAL> ...
<STRING_LITERAL> ...
<INPUT_PARAM> ...
<INTEGER_LITERAL> ...
<FP_LITERAL> ...
"TRUE" ...
"FALSE" ..."CONCAT" ...
"SUBSTRING" ...
"LOCATE" "(" "+" ...
"LOCATE" "(" "-" ...
"LOCATE" "(" "IdentificationVar" ...
"LOCATE" "(" <CHAR_LITERAL> ...
"LOCATE" "(" <STRING_LITERAL> ...
"LOCATE" "(" <INPUT_PARAM> "*" ...
"LOCATE" "(" <INPUT_PARAM> "/" ...
"LOCATE" "(" <INPUT_PARAM> "+" ...
"LOCATE" "(" <INPUT_PARAM> "-" ...
"LOCATE" "(" <INPUT_PARAM> "," "+" ...
"LOCATE" "(" <INPUT_PARAM> "," "-" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "." "CmpField" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "." "SingleValuedCmrField" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "*" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "/" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "+" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "-" ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" "," ...
"LOCATE" "(" <INPUT_PARAM> "," "IdentificationVar" ")" ...
"LENGTH" ...
"ABS" ...
"SQRT" ...
EJB QL statement : 'SELECT Object (o) FROM Order o WHERE (LOCATE (?1, o.isbn) > 0) AND ( o.status = ?2)'
EJB QL method : public abstract java.util.Collection EntityBeans.OrderHome.findByStatus(java.lang.String,int) throws java.rmi.RemoteException,javax.ejb.FinderException
]
app_Order_TestApp: Some tests failed.
Thank you
Amireddy
SELECT Object (o)
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This topic is more appropriate to the EJB forum. I will move it there for you.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!