Did you ever find out what the problem was? I'm having the same problem.
It seems to do it when a parent object has a many-many relation and the
child objects don't exist, but the relation mapping does.
Bert.
----- Original Message -----
From: "John Wang" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 14, 2001 7:04 AM
Subject: [castor-dev] Can't retrieve the resultsets while using OQL with
non-primary key query?
I found a problem while trying to make a OQL query using a non-primary key
in the where statement. For example, in the Castor JDO example, I create a
query to find the computer whose "cpu" is "Pentium", so I add the following
cde right before marshall coding:
db.begin();
file://test search from the computer using cpu property
System.out.println("Now search the cpu using Pentium");
computerOql = db.getOQLQuery( "SELECT c FROM myapp.Computer c WHERE
cpu = $1" );
computerOql.bind( "Pentium" );
results = computerOql.execute();
while ( results.hasMore() ) {
computer = (Computer) results.next();
writer.println( "Display existing computer: " + computer );
}
db.commit();
Marshaller marshaller;
.....
It didn't print anything! The SQL query printed out on screen is:
[test] SELECT
"COMPUTER"."ID","PROD"."NAME","PROD"."PRICE","PROD"."GROUP_ID","PR
OD_DETAIL"."ID","COMPUTER"."CPU" FROM "PROD","COMPUTER","PROD_DETAIL" WHERE
"COM
PUTER"."ID"="PROD"."ID" AND "COMPUTER"."ID"="PROD_DETAIL"."PROD_ID"(+) AND
("COM
PUTER"."CPU" = ?)
It did return a record when I run it against the database.
When I run it using "where id=?", it will return a record, why it don't work
for query on non-primary key?
Thanks a lot,
John
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev