max-l/Squeryl — pull request #159 by smessmer (2013-01-11 18:05:56+00:00)
Title: Fixing bug when nesting inTransaction(SessionFactory)

When nesting inTransaction(SessionFactory) statements, I get a

MySQLNonTransientConnectionException: No operations allowed after connection closed

The following examples work

inTransaction { inTransaction { ... } }
inTransaction(SessionFactory) { inTransaction { ... } }

But the following doesn't

inTransaction(SessionFactory) { inTransaction(SessionFactory) { ... } }

I looked at QueryDSL.scala and recognized, that the inTransaction(SessionFactory) {...} tries to enter a new session, also if there is already one there. The inTransaction without a session factory doesn't have this behaviour and just does nothing.

I think this should also be, what inTransaction(SessionFactory) should do, so I sent this pull request.

However, I'm not very used to the squeryl internals. So if there is a reason why inTransaction(SessionFactory) is implemented this way, please discard this pull request.