Use self.ctx.getSession() instead of self.factory