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).
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?
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,
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.
And if you want this kind of loopback behaviour, try specifying
true in ur ejb-jar.xml