• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Problems with EJB-QL queries

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
 
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This topic is more appropriate to the EJB forum. I will move it there for you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic