Walter, Were you able to get this to work? I am trying to get an example to work where all I want is to select the id of an object, so I've got something like this:
"CALL SQL SELECT MYOBJ_ID FROM MYOBJ_TBL AS com.vignette.MyObject" where the primary key for MyObj is myObj_id. I get a null pointer exception trying to build the query (for those of you scoring at home, that is at (or near, I think I have a little bit of custom code in the class)line 242 in SQLEngine. It is in the createCall method, and appears to be due to the fact that jdoFields0 is smaller than the other collections (because I'm only selecting one field?). Anyway, I really, really need to get this to work - any suggestions or work arounds? I am on 0.9.3.9, and can't move to another version just yet. But if there is a fix in the cvs version that I could retro-fit, that would be awesome... Thanks! -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 16, 2002 8:51 AM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] Pass Thru SQL throws exception I was responding to the parser error. As far as I know you must fill an object not just get random fields. Using custom SQL your query has to start with "CALL SQL" and end with "AS <full class name here>" The class needs to be in your mapping file ( I believe ) and the order of the fields needs to be the same as in your mapping file, with the exception that identity fields are at the very front even if they are not at the front of your mapping description. so in your example below why not return a full object and just use the fields that you want? Walt > Kevin, Vaneet, others..., > > How should I interpret this comment from > http://castor.exolab.org/jdo-faq.html then (see below). Does it not say I > can retrieve some single fields from my table? And isn't that also what > Walter is doing (Subject: problem with CALL SQL)? > > * > > Can I write a pass-thru OQL? > > Yes. Just put "CALL SQL" in front of your SQL statement. > > For example, > > OQLQuery oql = castorDb.getOQLQuery( > "CALL SQL SELECT id, name, date "+ > "FROM user WHERE upper(name) like $1"); > > Be remember that the order of the fields listed must match what is defined > in the mapping file. > > * > > Edwin > > -- > **************************************************************************** > 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 > ***************************************************** Walter Szewelanczyk IS Director M.W. Sewall & CO. email : [EMAIL PROTECTED] 259 Front St. Phone : (207) 442-7994 x 128 Bath, ME 04530 Fax : (207) 443-6284 ***************************************************** ----------------------------------------------------------- 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
