On Fri, Oct 2, 2009 at 4:42 PM, Quintin Beukes <quin...@skywalk.co.za>wrote:
> If you really only want to test the JPA entities, and don't mind the > transactions, why not remove the @Stateless and @EJB completely, and > just make your test @LocalClient and inject an entity manager? > That may be just the ticket. I wanted to avoid all the boilerplate of creating and committing transactions. If I inject an EntityManager into my LocalClient, is it managed by the container? Or does it behave in a more Java SE manner? Does it start and automatically commit the transaction? Mainly I'm looking to do whatever is simplest to get the auto-context-closing behavior of the local InitialContext, because that wipes out my in-memory H2 database automatically between tests. I wanted to combine that behavior with automatic transaction management to eliminate EntityManager boilerplate operations. Whatever is the simplest way to do this involving the least code--I'm all ears. Best, Laird