4 Replies Latest reply on Jul 20, 2002 3:14 PM by Wallace Zou

    You have an error in your SQL syntax near 'FOR UPDATE'

    Wallace Zou Newbie

      JDK1.4 + JBoss 3.0.0 + MySql

      I build a very simply application usinng CMP2.0, there are only two beans. One is entity the other is session, and session try to findByPrimayKey on entity.

      Everything is fine until I run my small client program, both JBoss console and client throw the exceptions:
      ------------------- From JBoss Concole -----------------
      11:36:45,640 ERROR [LogInterceptor] TransactionRolledbackException, causedBy:
      java.sql.SQLException: Syntax error or access violation: You have an error in yo
      ur SQL syntax near 'FOR UPDATE' at line 1
      at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source)
      at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source)
      at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)
      at org.gjt.mm.mysql.PreparedStatement.executeQuery(Unknown Source)
      at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeQ
      uery(LocalPreparedStatement.java:289)
      ... ...
      ... ...
      ---------------- The End ------------------
      java.rmi.ServerException: RemoteException occurred in server thread; nested exce
      ption is:
      java.rmi.ServerException: Load failed
      Embedded Exception
      Syntax error or access violation: You have an error in your SQL syntax near 'FOR
      UPDATE' at line 1; nested exception is:
      javax.ejb.EJBException: Load failed
      Embedded Exception
      ... ...
      ... ...
      ---------------- From Client Console ----------

      The ejb-jar is:
      -----------------------Start-----------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!-- edited with XML Spy v4.3 U (http://www.xmlspy.com) by Wallace Zou (C&A) -->
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <display-name>idm</display-name>
      <enterprise-beans>

      IdPool Entity Bean
      <display-name>IdPool</display-name>
      <ejb-name>IdPool</ejb-name>

      <local-home>ca.letstax.util.idm.IdPoolLocalHome</local-home>
      ca.letstax.util.idm.IdPoolLocal
      <ejb-class>ca.letstax.util.idm.IdPoolBean</ejb-class>

      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>IdPool</abstract-schema-name>
      <cmp-field>
      <field-name>idName</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>idType</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>idI</field-name>
      </cmp-field>
      <cmp-field>
      <field-name>idC</field-name>
      </cmp-field>
      <primkey-field>idName</primkey-field>

      ...
      ........

      </enterprise-beans>

      </ejb-jar>

      ---------------------- The end ----------------------

      Does anyone else met the same problem?

      I need any comments and advices.

      Thanks,

      a13519