Modified transaction locking to depend on relationship type and property uniqueness