Well, the error-message pretty much says it - you aren't allowed to access
persistent objects outside an active session, which means a transaction needs
to be going on.
Either do whatever you want to do before committing, or open a new transaction
afterwards.
Diez