3 Replies Latest reply on Dec 9, 2002 12:08 PM by Pascal Collet

    cannot create an entity bean followed by a getPrimaryKey()

    Pascal Collet Newbie

      All,

      I have been trying to create an entity bean from a session bean and right after get its primary key. It always throws an IllegalArgumentException when accessing the primary key. If I just create the entity bean then everything works just fine. Any idea? I'm stuck right now and I would appreciate any pointers/help.

      I'm running JBoss 3.0.4 with MySQL.

      [...]
      MyEntityBean eb = MyEntityBean.create(title, age);
      System.out.println("created "+eb.getPrimaryKey());
      [...]


      17:34:23,645 DEBUG [Study] Create: pk=null

      17:34:23,661 DEBUG [Study] Executing SQL: SELECT COUNT(*) FROM study WHERE uid=?

      17:34:23,661 DEBUG [Study] Executing SQL: INSERT INTO study (uid, protocol, title, public_access, study_design_uid) VALUES (?, ?, ?, ?, ?)

      17:34:23,661 DEBUG [Study] Rows affected = 1

      17:34:23,723 ERROR [LogInterceptor] TransactionRolledbackLocalException, causedBy:

      java.lang.IllegalArgumentException: Attempt to remove a lock for a null object

      at org.jboss.ejb.BeanLockManager.removeLockRef(BeanLockManager.java:103)

      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:124)

      at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:69)

      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)

      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:178)

      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)

      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)

      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)

      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)

      at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invoke(BaseLocalContainerInvoker.java:301)

      at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:38)

      at $Proxy79.getPrimaryKey(Unknown Source)