Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3100

ExecuteInsert of OracleSequenceCommand not called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • JBossAS-4.0.4.GA
    • JBossAS-4.0.3 SP1
    • CMP service
    • None
    • Medium

    Description

      We tried to use the defined sequence to autogenerate new keys for CMP beans, however we get the following in the log:
      2006-04-13 11:56:35,367 DEBUG org.jboss.ejb.plugins.cmp.jdbc.JDBCEJBQLQuery.Hugo#findAll Executing SQL: SELECT DISTINCT t0_o.hugopkfield FROM HUGO t0_o
      2006-04-13 12:00:36,334 DEBUG [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleSequenceCreateCommand.Hugo] Executing SQL:

      {call INSERT INTO HUGO (hugopkfield, PRIORITY) VALUES (REPORT_REPORTID_SEQ.NEXTVAL, ?) RETURNING hugopkfield INTO ? }

      2006-04-13 12:02:48,314 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
      2006-04-13 12:03:46,768 WARN [org.jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=office-hugo/17, BranchQual=, localId=17] timed out. status=STATUS_ACTIVE
      2006-04-13 12:08:24,457 ERROR [org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleSequenceCreateCommand.Hugo] Could not create entity
      java.sql.SQLException: Missing IN or OUT parameter at index:: 2
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
      at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:1536)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2900)
      at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2977)
      at oracle.jdbc.driver.OracleCallableStatement.executeUpdate(OracleCallableStatement.java:4141)
      at com.p6spy.engine.logging.P6LogCallableStatement.executeUpdate(P6LogCallableStatement.java:155)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:227)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCIdentityColumnCreateCommand.executeInsert(JDBCIdentityColumnCreateCommand.java:51)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.performInsert(JDBCAbstractCreateCommand.java:308)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractCreateCommand.execute(JDBCAbstractCreateCommand.java:138)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:572)
      at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:222)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:219)
      at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:766)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:1113)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:189)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:180)
      at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:90)
      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:119)
      at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
      at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
      at org.jboss.ejb.plugins.CallValidationInterceptor.invokeHome(CallValidationInterceptor.java:41)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:110)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:389)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:146)
      at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:130)
      at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:121)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
      at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:508)
      at org.jboss.ejb.Container.invoke(Container.java:894)

      After tracing into JBOSS it appears that the class JDBCAbstractCreateCommand calls "int rowsAffected = executeInsert(index, ps, ctx);" on line 308 whcih has 3 arguments.
      However we expected it should call "protected int executeInsert(PreparedStatement ps, EntityEnterpriseContext ctx) throws SQLException" in line 87 of class JDBCOracleSequenceCreateCommand, which needs 2 arguments.
      Because of this the executeInsert method of the abstract class is used instead, which fails to register the OUT parameter. resulting in the error in the log above.

      Am I doing something wrong or is this somethig that needs to be resolved?

      Kind Regards,

      Hugo

      p.s. this is my jbosscmp-jdbc.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 4.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_4_0.dtd">

      <jbosscmp-jdbc>
      <defaults>
      <datasource>java:/jdbc/ctb</datasource>
      <datasource-mapping>Oracle9i</datasource-mapping>
      <create-table>true</create-table>
      </defaults>

      <enterprise-beans>

      <!--
      To add beans that you have deployment descriptor info for, add
      a file to your XDoclet merge directory called jbosscmp-jdbc-beans.xml
      that contains the <entity></entity> markup for those beans.
      -->

      <entity>
      <ejb-name>Hugo</ejb-name>
      <create-table>true</create-table>
      <pk-constraint>false</pk-constraint>

      <cmp-field>
      <field-name>hugopkfield</field-name>

      </cmp-field>
      <cmp-field>
      <field-name>priority</field-name>
      <column-name>PRIORITY</column-name>

      <jdbc-type>DOUBLE</jdbc-type>
      <sql-type>NUMBER(15,8)</sql-type>

      </cmp-field>

      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <field-name>hugopkfield</field-name>
      <column-name>HUGOPKFIELD</column-name>
      <jdbc-type>INTEGER</jdbc-type>
      <sql-type>NUMBER(10)</sql-type>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="oracle-sequence" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleSequenceCreateCommand">
      <attribute name="sequence_name">REPORT_REPORTID_SEQ</attribute>
      </entity-command>
      <!-- jboss 3.2 features -->
      <!-- optimistic locking does not express the exclusions needed -->
      </entity>

      </enterprise-beans>

      </jbosscmp-jdbc>

      Attachments

        Activity

          People

            olubyans@redhat.com Alexey Loubyansky
            holeinone_jira HoleInOne (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: