0 Replies Latest reply on Mar 7, 2002 11:42 AM by rfmellobr

    JBOSS + MySQL errors of PK Duplication, but the record wasn'

    rfmellobr

      Hi all,

      I created a CMP Entity Bean, but it didn't work on JBOSS 2.4.4 + MySQL (mysql Ver 11.6 Distrib 3.23.28-gamma, for pc-linux-gnu (i686)).

      I have 8 records in the table, these records have the
      following Primary Keys (1, 2, 3, 4, 5, 6, 7 and 8).
      I did a method to get the max value of the primary key
      and it generates the next. In this case the next is 9, 10
      and further...

      When I try to execute the code it gets te next value and
      create the Entity Bean, but the data is not stored in
      the database. Who knows why????

      When I try to execute te code again, as I say firstly,
      the data is not stored, so it gets the same primary
      key for the next Entity Bean, in this case the error
      generated is:

      [ERROR,Default] javax.ejb.DuplicateKeyException: Entity with key 28 already exists
      [ERROR,Default] at org.jboss.ejb.plugins.jaws.jdbc.JDBCCreateEntityCommand.execute(JDBCCreateEntityCommand.java:131)
      [ERROR,Default] at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createEntity(JAWSPersistenceManager.java:128)
      [ERROR,Default] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:231)
      [ERROR,Default] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:632)
      [ERROR,Default] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [ERROR,Default] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:42)
      [ERROR,Default] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:28)
      [ERROR,Default] at java.lang.reflect.Method.invoke(Method.java:327)
      [ERROR,Default] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:859)
      [ERROR,Default] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:234)
      [ERROR,Default] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:147)
      [ERROR,Default] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:97)
      [ERROR,Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:142)
      [ERROR,Default] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:347)
      [ERROR,Default] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      [ERROR,Default] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:102)
      [ERROR,Default] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:103)
      [ERROR,Default] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:421)
      [ERROR,Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:456)
      [ERROR,Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invokeHome(HomeProxy.java:237)
      [ERROR,Default] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:182)
      [ERROR,Default] at $Proxy27.create(Unknown Source)



      Anyone knows how I can solve this problem????
      I need to create te Entity Bean and store the data!!!

      My Entity Bean is Container Manager!!!!

      Cheers,

      Rodrigo Fernandes de Mello