intershop

Intershop 7 - property for controlling transaction locking type


Reading through the Intershop documentation I have come accross mentions of pesimistic and optimistic locking mechanics (where optimistic is implemented through the OCA attribute in database tables).

I'm wondering how to control which type of locking is used throughout the database and where to read more about these locking types.


Solution

  • As far as I know, there is only optimistic locking on object level and this cant be disabled. Every table in intershop has an OCA column for this reason. You do have other ways of locking however

    For example:

    ORMObject.tryLock. This lock the actual row in the database by using a query : select for update nowait. I wont recommend using this, you might end up with some rather hard to debug deadlock bugs. See the javadoc for more.

    Then there is Locking Framework. It doesn't actually stop any process from updating data, it is a ways for intershop to orchestrate different process by having them lock resources so that they dont get in each others way. However u can still ignore these locks.

    I generally try to avoid locking. This KB might be interesting for you especially the part on Transaction Scopes.