Actually, I there was an error in my earlier e-mail. Session Bean A (The Stateless Front End) should have transaction attribute "NotSupported". There's no such transaction attribute as "NotRequired". I'm drawing attention to this because I don't want anyone to mistake my use of "NotRequired" for the transaction attribute "Supports". "Supports" won't do because there must never be a transaction in place when you go to create and remove your stateful session bean and "Supports" still allows existing transactions to be propogated into the method call.
Also, since Stateful Session Beans are pooled, you should probably put the call to sfsb.remove() inside a finally block to provide deterministic cleanup of the stateful session bean, allowing it to be immediately returned to the pool. Yes, the garbage collector should eventually reclaim the resource, but it's non-deterministic when that runs. So, for the record, the solution should be like the following. ---------------------------------------------------------------------- --------------- STATELESS FRONT END ------------------ /** * @ejb:interface-method * @ejb:transaction="NotSupported" <<<<<< */ public void someMethod(String arg1) { try { StatefulEJBLocal sfsb = StatefulEJBUtil.getLocalHome().create(); StatelessEJBLocal slsb = StatelessEJBUtil.getLocalHome.create(); slsb.anotherMethod(sfsb,arg1); } finally { Helper.remove(sfsb); //Helper.remove() should simply call sfsb.remove() and catch any exceptions thrown. //It's a very bad thing to allow finally blocks to throw exceptions of their own. } } slsb.anotherMethod() MUST have transactional scope, and it MUST do ALL the transactional stuff required in someMethod()!!! someMethod()'s only responisbility is creating sfsb! ------------------------------------------------------- I definitely prefer this stateless front end design to all the others discussed. Doug P.S. The Transaction.registerSychronization(sync) method is on javax.transaction.Transaction but not javax.transaction.UserTransaction. Since UserTransaction is all that you're required to have access to in the application server (EJB 2.0 Spec Sec. 24.1.1, p. 494), I'll have to get back to you regarding using regular Java objects implementing javax.transaction.Synchronization after I ask around a little. ==========================================================================To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff EJB-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".