You mean a client application that is talking to an EJB? You get the UserTransaction from JNDI: Context jndiCtx = new InitialContext(); // you may need properties for the InitialContext UserTransaction tx = (UserTransaction) jndiCtx.lookup("java:comp/UserTransaction"); tx.begin(); // ... tx.commit(); // or tx.rollback(); If you are trying to get the UserTransaction from within a CMP bean, you can not - Entity beans should have declarative transactions (set in deployment descriptor).
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop