Ay reason why you're passing a Database object around and using raw connections, instead of doing everything in a single withSession block and passing the session?