Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 29th, 2003, 09:10 AM
Registered User
 
Join Date: Sep 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with EJB-QL queries

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.Da te) 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.Dat e) 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.Strin g,int) throws java.rmi.RemoteException,javax.ejb.FinderException
]
app_Order_TestApp: Some tests failed.

Thank you
Amireddy





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run ejb haribaskerk EJB 0 February 14th, 2007 04:59 AM
EJB gillani EJB 1 July 1st, 2006 07:57 PM
J2EE with out EJB arun_sunmic J2EE 2 January 16th, 2006 07:16 AM
EJB 3.0 GLichten BOOK: Expert One-on-One J2EE Design and Development 0 December 1st, 2005 06:02 AM
Combining Queries or results from 2 queries Ford SQL Server 2000 24 November 7th, 2005 08:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.