4 Replies Latest reply on Jan 3, 2004 9:02 AM by raja05

    Reenetrancy problems

    ereze


      I run on JBoss 3.2.1, I have two entities a user and a profile.
      For some reason, I get javax.ejb.EJBException:
      "Reentrant method call detected" when a method in the Profile does


      ProfileBean.myMethod() {
       .....
       getUser().getUserId (); // this line raises the exception
      }
      


      Why is this bad?

      Thanks in advance,

      Erez

        • 1. Re: Reenetrancy problems
          raja05

          Are you calling the ProfileBean object from userbean. In that case,

          UserBean --> Profilebean.mymethod --> getUser() ---> Tries to retrieve the UserBean that called profilebean (Thus causing the reentrancy).

          • 2. Re: Reenetrancy problems
            ereze

            Hi Raj,

            It's not exactly the wayyou described it but very close to it. But why is it forbidden?? for what good reason?
            I come from the ODMG (object orinented databases) field where there is no such thing like forbidding me to call freely what ever method of what ever entity taking away the security issues.

            Is there a good reason?

            Regards,

            Erez

            • 3. Re: Reenetrancy problems
              raja05

              From the Spec 10.5

              An entity Bean Provider can specify that an entity bean is non-reentrant. If an instance of a non-reentrant
              entity bean executes a client request in a given transaction context, and another request with the
              same transaction context arrives for the same entity object, the container will throw an exception to the
              second request. This rule allows the Bean Provider to program the entity bean as single-threaded,
              non-reentrant code.
              The functionality of entity beans with container-managed persistence may require loopbacks in the
              same transaction context. An example of a loopback is when the client calls entity object A, A calls
              entity object B, and B calls back A in the same transaction context. The entity bean’s method invoked
              by the loopback shares the current execution context (which includes the transaction and security contexts)
              with the Bean’s method invoked by the client.




              • 4. Re: Reenetrancy problems
                raja05

                And if you want this kind of loopback behaviour, try specifying
                true in ur ejb-jar.xml