Hi,

 

I'm trying to execute a delete all statement on an object (delete all where a non-identity field, username, equals a parameter).  I've tried the following versions, and keep getting an exception:

 

"DELETE userrole FROM dataobject.UserRoleDO userrole WHERE username = $1";

"DELETE FROM dataobject.UserRoleDO userrole WHERE username = $1";

"DELETE dataobject.UserRoleDO userrole WHERE username = $1";

 

 

Here is the exception:

Org.exolab.castor.jdo.oql.OQLSyntaxException: An incorrect token type was found near DELETE (found IDENTIFIER, but expected KEYWORD_SELECT)

            At org.exolab.castor.jdo.oql.Parser.match(Parser.java:208)

 

 

Here's the relevant section of the mapping file (note I'm trying to delete based on a field that is not the identity column):

 

   <class name="dataobject.TAPUserRoleDO" identity="associd" access="shared" key-generator="MAX">

      <cache-type type="unlimited"/>

 

      <map-to table="tapmeta.User_Roles" />

      <field name="associd" required="true" type="integer" > 

         <sql name="Assoc_ID"  type="integer" /> 

      </field>

      <field name="username" required="true" type="string"> 

         <sql name="User_Name"  type="char" /> 

      </field>

      <field name="rolename" required="true" type="string"> 

         <sql name="Role_Name"  type="char" /> 

      </field>

   </class>

 

 

Thanks in advance,

 

Alex

Reply via email to