1 Reply Latest reply on Oct 22, 2004 11:01 AM by Eugene Gluzberg

    How to prevent for update usage in one ejbSelect method in r

    Eugene Gluzberg Newbie

      I've created an ejbSelect statement that uses the following ejbQL:
      <query-method>
      <method-name>ejbSelectMaxDBID</method-name>
      <method-params/>
      </query-method>
      <result-type-mapping>Local</result-type-mapping>
      <ejb-ql>select max( o.orderdbid ) from OrderTable o</ejb-ql>

      I've set this bean with <row-locking> true because I would like the bean to lock the rows whenever its loaded. However I get the error below.... How do I turn off Row locking for this ejb-select method only? Is this possible with declared-sql or jboss-ql?

      Isnt this a jboss bug? I dont think for update should be used in methods where any function is present...

      18:11:59,131 DEBUG [OrderTable#ejbSelectMaxOrderId] Find failed
      java.sql.SQLException: ORA-01786: FOR UPDATE of this query expression is not all
      owed

      at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2321)
      at oracle.jdbc.oci8.OCIDBAccess.parseExecuteDescribe(OCIDBAccess.java:12
      55)
      at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
      a:2391)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
      nt.java:2672)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePrepar
      edStatement.java:589)
      at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePrepare
      dStatement.java:527)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery
      (WrappedPreparedStatement.java:314)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCA
      bstractQueryCommand.java:198)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractQueryCommand.execute(JDBCA
      bstractQueryCommand.java:117)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.execute(JDBC
      SelectorBridge.java:96)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCSelectorBridge.invoke(JDBCS
      electorBridge.java:69)
      at org.jboss.ejb.plugins.cmp.bridge.EntityBridgeInvocationHandler.invoke
      (EntityBridgeInvocationHandler.java:91)
      at org.jboss.proxy.compiler.Runtime.invoke(Runtime.java:62)
      at com.tullib.otcee.ejb.orders.OrderTableBean$Proxy.ejbSelectMaxOrderId(
      )
      at com.tullib.otcee.ejb.orders.OrderTableBean.ejbHomeLoadMaxDBID(OrderTa
      bleBean.java:71)