1 Reply Latest reply on Jul 27, 2005 5:20 AM by Denis Etienne

    ejbLoad() and context.getPrimaryKey()

    Denis Etienne Newbie

      Hello,

      I am trying to implement methods for an entity bean using Hibernate.
      I was able to create data in the tables using a simple java application.

      And I have also a Web application that tries to display all the objects in the tables... I have seen Hibernate query fetching all the rows, but when JBoss try to call my ejbLoad method, then context.getPrimaryKey() returns the Bean object and not the primary key.

      I can see that from the log file ...

      java.rmi.NoSuchObjectException: Deprecated
       at org.jboss.ejb.plugins.AbstractInstanceCache.get(AbstractInstanceCache.java:118)
       at org.jboss.ejb.plugins.EntityInstanceCache.get(EntityInstanceCache.java:61)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:166)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
      

      Any idea ?
      Thanks.

        • 1. Re: ejbLoad() and context.getPrimaryKey()
          Denis Etienne Newbie

          First I should have said it was BMP with JBoss 4.0.0 and Hibernate and Spring.
          But I fixed it... that was a mistake I did:

          My finder implementation called ejbFindByLanguage returned collection of beans instead of collection of primary keys.

          I just replaced
          from TeddyBean t where t.language=?
          with
          select t.id from TeddyBean t where t.language=?

          in ejbFindByLanguage and that was fixed.