named isInsideTransaction() should be used in named closeTx()
Prevent connection leaks: do not create new EntityManager if transaction is not active.

These newly-created EMs are not bound to thread and thus never closed.
This is also how play 1.2.x used to work: no transaction - cannot read from DB.
use JPA.DEFAULT constant, as a few lines above
simplify code: use ThreadLocal's initialValue() to greatly reduce number of null checks
use more efficient iterations and remove unused some code
Allow developers to enable c3p0 logging for eg connection leak debugging via Log4J configuration.
FallbackMLog logs to system error, which is not convenient.
throw JPAExceptions in case of JPA errors instead of RuntimeExceptions - suggestion by xael-fry

catch in isInsideTransaction() is not needed anymore as well, as JPAException is never thrown from the try block
Restore method isInitialized to detect if JPA is initialized
Merge pull request #804 from codeborne/fix-transactions

[#1879] Prevent DB connection leaks in Play 1.3.x