Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3080

Usage of EJBObject/EJBLocalObject during ejbLoad()/ejbStore() leads to recursions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • JBossAS-3.2.7 Final, JBossAS-4.0.1 SP1
    • EJB2
    • None
    • Medium
    • Workaround Exists
    • Hide

      Avoid recursions in ejbLoad()/ejbStore() using flags indicating if already in ejbLoad()/ejbStore().

      Show
      Avoid recursions in ejbLoad()/ejbStore() using flags indicating if already in ejbLoad()/ejbStore().

    Description

      Consider the following Entity EJB, BMP:

      public class MyEntity
      implements EntityBean
      {
      private EntityContext context;

      public MyEntity()
      {
      }

      // From local bean interface
      public void doSomething()

      { // Noop, just for demo }

      public void setEntityContext(EntityContext P_context)

      { context = P_context; }

      public void unsetEntityContext()

      { context = null; }

      public void ejbActivate() {}

      public void ejbPassivate() {}

      public Integer ejbFindByPrimaryKey(Integer Pi_id)
      throws FinderException

      { // Select id from database }

      public Integer ejbCreate(Integer Pi_id)
      throws CreateException

      { // Insert in database return Pi_id; }

      public void ejbPostCreate(Integer Pi_id) {}

      public void ejbRemove()
      throws RemoveException

      { // Delete in database }

      public void ejbLoad()

      { // Select from database // Causes recursion - always context.getEJBLocalObject().doSomething(); }

      public void ejbStore()

      { // Update in database // Causes recursion - depending on transaction attributes and readonly/read-write context.getEJBLocalObject().doSomething(); }

      }

      According to the EJB spec 2.0 it should be allowed to use EJBObject/EJBLocalObject during ejbLoad()/ejbStore(). If so this does not work on JBoss as a recursion is produced by the EntitySynchronizationInterceptor#invoke(Invocation) when checking against EnterpriseContext#isValid().

      Attachments

        Activity

          People

            Unassigned Unassigned
            mjachs_jira Martin Jachs (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: