Brad,

Your syntax is an invalid OQL. The "*" is valid to SQL, but not OQL.
Please see the OQL document on the castor website.



Thomas

-----Original Message-----
>From: Brad Matlack [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, August 22, 2001 1:13 PM
>To: [EMAIL PROTECTED]
>Subject: [castor-dev] SQL syntax errors
>
>Hi,
>
>When I try to execute a select using this statement:
>OQLQuery oql = db.getOQLQuery( "SELECT * FROM Message" );
>
>I get this exception:
>org.exolab.castor.jdo.oql.OQLSyntaxException: An inapropriate token (20)
was
>encountered in an expression.
>(Note: Hex 20 is a space)
>
>And when I execute a create:
>try{
>     db.begin();
>     db.create(message);
>     db.commit();
>    }catch(Exception e){
>     db.rollback();
>     throw new Exception(e.getMessage());
>    }
>
>I get this exception:
>java.sql.SQLException: Syntax error or access violation: You have an error
>in your SQL syntax near 'SELECT MAX(t1.id) FROM message t1)' at line 1.
>(Note the extra parenthesis at the end of the statement)
>
>Here is my mapping.xml statement:
><!--  Mapping for Message  -->
> <class name="com.workzen.app.velocityCastor.om.Message" identity="id"
>key-generator="MAX">
>  <map-to table="message" xml="message"/>
>    <field name="id" type="integer" >
>      <sql name="id" type="integer"/>
>      <xml node="attribute"/>
>    </field>
>    <field name="subject" type="string">
>      <sql name="subject" type="char" dirty="check" />
>      <xml node="text" />
>    </field>
>  <field name="name" type="string">
>      <sql name="name" type="char" dirty="check" />
>      <xml node="text" />
>    </field>
>  <field name="email" type="string">
>      <sql name="email" type="char" dirty="check" />
>      <xml node="text" />
>    </field>
>  <field name="contents" type="string">
>      <sql name="contents" type="char" dirty="check" />
>      <xml node="text" />
>    </field>
>  <field name="submitted" type="string">
>      <sql name="submitted" type="char" dirty="check" />
>      <xml node="text" />
>    </field>
>  </class>
>
>What am I doing wrong???
>Any help would be greatly appreciated,
>Brad
>
>-----------------------------------------------------------
>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

Reply via email to