3 Replies Latest reply on Apr 16, 2002 10:02 AM by ksspatro

    INSERTING AN ALREADY EXISTING BEAN

    Lamouret Newbie

      Hi,
      I'm using JBoss 2.2 with Postgresql 7.1

      I'm used SessionBean which calls EntityBeans to access to the persistence storage.
      Firstly, i've removed one instance of an entity bean, by calling EntityBean.remove() method in my SessionBean.
      Secondly, in an other transaction, i'm trying to create a new data with this EntityBean, by calling EntityBean.create(data) method from my SessionBean. But when i call this method, I've this exception :

      [EntityBeanName] Activated bean EntityBeanName with id = EntityBeanPK@fe
      [EntityBeanName] TRANSACTION ROLLBACK EXCEPTION:null; nested exception is:
      javax.ejb.EJBException
      [EntityBeanName] java.lang.IllegalStateException: INSERTING AN ALREADY EXISTING BEAN, ID = EntityBeanPK@fe
      [EntityBeanName] at org.jboss.ejb.plugins.AbstractInstanceCache.insert(AbstractInstanceCache.java:207)
      [EntityBeanName] at org.jboss.ejb.plugins.BMPPersistenceManager.createEntity(BMPPersistenceManager.java:165)
      [EntityBeanName] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:441)
      [EntityBeanName] at java.lang.reflect.Method.invoke(Native Method)
      [EntityBeanName] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:639)
      [EntityBeanName] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:160)
      [EntityBeanName] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:87)
      [EntityBeanName] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
      [EntityBeanName] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:263)
      [EntityBeanName] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      [EntityBeanName] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:164)
      [EntityBeanName] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      [EntityBeanName] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:316)
      [EntityBeanName] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:436)
      [EntityBeanName] at org.jboss.ejb.plugins.jrmp.interfaces.HomeProxy.invoke(HomeProxy.java:212)
      [EntityBeanName] at $Proxy182.create(Unknown Source)

      What does it mean ? What's the problem ?

      Thanks for your help.

      Bruno