The basic unit of work for Castor is an object. Normally one row in a table
(or possibly multiple tables) equates to an instance of an object. One field
in a table is kind of meaningless to Castor without an object/class binding.
I'm doing something like this using Oracle. My class mapping looks like
this:
<class name="QueryIntResults identity="result">
<map-to table="DUAL" />
<field name="results" set-method="setResults" get-method="getResults"
type="int">
<sql name="RESULT" />
</field>
</class>
This mapping lets me do things like:
CALL SQL select count(*) result from foo where foo.attribute = 'someValue'
AS QueryIntResults
Castor hands me back a QueryIntResults object containing the value from the
query.
Hope this helps,
Kevin
-----Original Message-----
From: Edwin van Stam [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 16, 2002 8:39 AM
To: [EMAIL PROTECTED]
Subject: [castor-dev] Pass Thru SQL throws exception
Dear Castor developers,
I'm trying to retrieve one field from my table. I understand that I cannot
do that using plain OQL but need to write a SQL Pass Thru query. So I write:
> OQLQuery qry = db.getOQLQuery("CALL SQL SELECT firstName FROM
> T_USER");
But when executing I get the following exception:
> org.exolab.castor.jdo.QueryException: Stored procedure call must end
> with
"AS <class-name>"
When retrieving a complete row this is understandable, but I'm retrieving
one field only. Judged by other messages in this mailing list, other people
do not seem to have this problem.
Could anyone tell me what I am missing here?
Thanks,
Edwin van Stam
--
****************************************************************************
This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is only intended
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorized to read, print, retain, copy disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.
****************************************************************************
-----------------------------------------------------------
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