This one time, at band camp, David Jencks said: DJ>I really can't tell what you are doing from your description, and you DJ>appear at one point to imply that you have a BMT entity bean which is DJ>impossible. DJ> DJ>The spec is trying to lead you, in a stateless session bean, to code ut DJ>usage something like this: DJ> DJ>ut.begin(); DJ>try { DJ>//do something DJ>} finally { DJ>ut.commit();//or rollback DJ>} DJ> DJ>Is this what you have?
I'm using a BMT session bean to front classses composing a DAO pattern. The client is a simple Java application. The BMT session bean exposes the methods startSession(), cancelSession() and endSession(). These methods encapsulate the begin, rollback, commit of the UT. A UT is started by a call from the client to the BMT session bean's startSession() which fetches the UT from the SessionContext and called begin() on it. Here is the relevant code: client: service = ServiceBroker.getPlanLockService(); ... service.startSession(); // do some work service.endSession(); bean: public void ejbCreate() throws CreateException { initConnection(); } ... private void initConnection() { Context ctx; StringBuffer sb; DaoFactory factory; if ( _dataSource == null && _jndiName != null ) { try { ctx = new InitialContext(); sb = new StringBuffer(); sb.append( "java:" ); sb.append( _jndiName ); _dataSource = ( DataSource ) ctx.lookup( sb.toString() ); factory = LtpDaoFactory.getDaoFactory( LtpDaoFactory.JDBC, _dataSource.getConnection() ); _dao = factory.getDao ( PlanLock.class ); } catch (Exception e ) { throw new EJBException( "Failed to initialize PlanLock Service!", e ); } } } ... public void startSession() throws DaoException, RemoteException { try { UserTransaction userTx = context.getUserTransaction(); userTx.begin(); } catch (Exception ex ) { throw new DaoException("Error starting transaction: ",ex ); } } BTW, I inherited this design from someone else. I'm starting to think that it should be ripped apart and made to be more lightweight. Bruce -- perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");' ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user