Well, if you are in the container you get all the nice services provided for your. Out of the container, you will need to include them. For instance, JPA requires a Connection Pool, so outside the container you will need to include a Connection Pool API, say for instance C3PO. Same thing with Transactions.