This content has been marked as final.
Show 5 replies
-
1. Re: getEJBLocalObject, CMR, ejbPostCreate, and Reentrant met
aloubyansky Jul 22, 2004 4:36 AM (in response to tomerbd)You are probably invoking some methods on Entity1 in Entity2's ejbCreate or ejbPostCreate.
10.5.11 Non-reentrant and re-entrant instances
...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..."
If you need to have Entity1's CMP field values in Entity2's ejbCreate or ejbPostCreate you should pass them as parameters to Entity2's ejbCreate and ejbPostCreate. -
2. Re: getEJBLocalObject, CMR, ejbPostCreate, and Reentrant met
tomerbd Jul 24, 2004 3:35 AM (in response to tomerbd)Well, in ejb2 create/postCreate im not calling ejb1 (but my guess would be that jboss is calling it under the hoods...) the code looks like this
ejb2.create(ejb1)
and in ejb2 create method
setOwner(ejb1)
so is there generaly a way to pass ejb1 to ejb2 and in ejb2 setting setOwner(ejb1) without having reentrant methods? -
3. Re: getEJBLocalObject, CMR, ejbPostCreate, and Reentrant met
aloubyansky Jul 25, 2004 3:27 AM (in response to tomerbd)This works for me.
In entity A:public void ejbPostCreate(Long id, String name) { try { CUtil.getLocalHome().create((ALocal)ctx.getEJBLocalObject()); } catch(Exception e) { e.printStackTrace(); } }
In entity C:public Long ejbCreate(ALocal a) throws CreateException { setId(new Long(11)); return null; } public void ejbPostCreate(ALocal a) { setA(a); }
What version are you using? -
4. Re: getEJBLocalObject, CMR, ejbPostCreate, and Reentrant met
aloubyansky Jul 25, 2004 3:28 AM (in response to tomerbd)And post the stacktrace.
-
5. Re: getEJBLocalObject, CMR, ejbPostCreate, and Reentrant met
tomerbd Jul 31, 2004 1:10 PM (in response to tomerbd)You are right. I gave it another shot and it seems to be working fine!