check study lock to prevent EJBTransactionRolledbackException

- also, refactor getStudyLockMessage to separate class