issue #20154: Only obtainLock when the model is lockable. Let this be set reflectively by the orm setting.
issue #20154: Introduce getId function and refactor.
issue #20154: swat.