I the problem lies in the fact that you are referring to product in the
where clause...and castor doesn't know product
So, in my opinion...the query should be formulated like this:
SELECT o FROM myapp.Product o WHERE o.group=3 (and not SELECT o FROM
myapp.Product o WHERE product.group=3)
In case your product has an id field/attribute, the query should be
formulated like this:
SELECT o FROM myapp.Product o WHERE o.id=3
In fact, you select an o object from myap.Product...and then you have to use
that selected object in the where clause as well...So, where o.group=3, in
which case Product has a "group" attribute.
Like I said before, somethink like this should work:
db = CastorToolkit.getDatabase();
db.begin();
oql = db.getOQLQuery("SELECT rule FROM
be.realsoftware.datastore.persistence.xml.fraudrule.FraudRule rule "
+ "WHERE
rule.IdtFraudRule=$1");//IdtFraudRule is an attribute of the rule object !!!
oql.bind(ruleVO.getIdtFraudRule());
results = oql.execute();
In the select clause, you define the object you wanna work on...in the where
clause, you should work on that declared object.
So, if you declare o as an myapp.Product object in the select clause, you
should use that same declared object in the where clause too.
Once again, I hope it will work just as fine for you as for me...OQL is
wonderful!
Nico
-----Original Message-----
From: Sandeep Bhasin [mailto:[EMAIL PROTECTED]
Sent: dinsdag 24 juni 2003 11:30
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] JDO: OQL Question...
Hi,
Simply use
SELECT o FROM myapp.Product o WHERE product.group=3
Sandy.
-----Original Message-----
From: Tetley, Paul [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 24, 2003 2:46 PM
To: [EMAIL PROTECTED]
Subject: [castor-dev] JDO: OQL Question...
In the Castor 0.9.5 examples (the JDO Example) I've the OQL Query
Analyzer GUI tool and tried to run the query:
SELECT o FROM myapp.Product o WHERE product.group.id=3
I get an exception:
org.exolab.castor.jdo.QueryException: An unknown field was requested:
product.group.id (myapp.Product AS prod)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.checkProjection(ParseTreeWalke
r.java:485)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.checkWhereClause(ParseTreeWalk
er.java:566)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.checkWhereClause(ParseTreeWalk
er.java:590)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.checkWhereClause(ParseTreeWalk
er.java:590)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.checkErrors(ParseTreeWalker.ja
va:236)
at
org.exolab.castor.jdo.oql.ParseTreeWalker.<init>(ParseTreeWalker.java:13
7)
at
org.exolab.castor.jdo.engine.OQLQueryImpl.create(OQLQueryImpl.java:275)
...
Am I asking the wrong question (in which case how should the query be
formulated)?
Or is there a problem with my database (HypersonicSQL)?
Or is it a bug?
:-)
TIA
Paul Tetley
AeM Group
Perth, Western Australia
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
**************************Disclaimer************************************
Information contained in this E-MAIL being proprietary to Wipro Limited is
'privileged' and 'confidential' and intended for use only by the individual
or entity to which it is addressed. You are notified that any use, copying
or dissemination of the information contained in the E-MAIL in any manner
whatsoever is strictly prohibited.
***************************************************************************
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev