0 Replies Latest reply on Dec 29, 2005 2:47 PM by Benoit Meilleur

    CMR and Auto-increment

    Benoit Meilleur Newbie

      Hi,

      I'm trying to deploy an existing weblogic 6.1 on JBoss 4.0.3 with an Oracle Database 8.

      There are some CMP 2.0 for which I configured the auto-increment data in my jbosscmp-jdbc.xml. It wasworking fine but then I was getting another issue with relationship at insert time, because it was said to be null. So I put true to <insert-after-ejb-post-create> in the standardjboss.xml. Now that both solutions are applied, the primary key of my entity doesn't seem to come from the auto-increment anymore because I'm getting the following exception on each insert:

      javax.ejb.CreateException: Primary key for created instance is null.

      Here's the values I have defined:

      [standardjboss.xml]
      <container-configuration>
      <container-name>Standard CMP EntityBean</container-name>
      <call-logging>false</call-logging>
      <invoker-proxy-binding-name>entity-rmi-invoker</invoker-proxy-binding-name>
      <sync-on-commit-only>false</sync-on-commit-only>
      <insert-after-ejb-post-create>true</insert-after-ejb-post-create>
      ...


      [jbosscmp-jdbc.xml]


      <ejb-name>PorPortalPortlet</ejb-name>
      (...)
      <unknown-pk>
      <unknown-pk-class>java.lang.Integer</unknown-pk-class>
      <field-name>portalPortletId</field-name>
      <auto-increment/>
      </unknown-pk>
      <entity-command name="oracle-sequence" class="org.jboss.ejb.plugins.cmp.jdbc.keygen.JDBCOracleCreateCommand">
      POR_PORTAL_PORTLET_ID_SEQ
      </entity-command>


      Anyone has any ideas why this is happening?

      Thanks,