Intershop 7:事务锁类型控制方式及锁机制相关资料咨询
Great question! Let's break this down based on my experience working with Intershop's persistence layer:
全局层面控制锁类型的使用
Intershop gives you flexible ways to set lock behavior across your entire database, plus options to override settings for specific entities:
Set a global default lock type
You can define the default lock mechanism for all persistent objects using the system propertypersistence.objectlock.default.type. Add this line to yourintershop.propertiesfile, setting the value to eitheroptimisticorpessimistic:persistence.objectlock.default.type=optimisticThis will apply to every entity that doesn't have a custom lock type configured.
Override lock type for specific entities
If you need certain high-contention entities (like orders or inventory items) to use a different lock type, you can set this directly in the entity's persistence definition XML file. Add a<lock-type>node inside the<entity>block—this setting takes precedence over the global default:<entity name="Order" table="ORDERS"> <lock-type>pessimistic</lock-type> <!-- Rest of your entity configuration --> </entity>Database-level isolation settings
For pessimistic locks, Intershop relies on your database's native row locking capabilities. Make sure your database's transaction isolation level is set appropriately (common choices areREAD_COMMITTEDorREPEATABLE_READ). You can also configure this via Intershop's system property:persistence.connection.isolationlevel=READ_COMMITTED
Where to get more details on these lock mechanisms
Here are the most reliable sources to dive deeper:
Official Intershop Persistence Documentation
The official docs explain exactly how optimistic locks leverage the OCA (Object Concurrency Attribute)—this is the auto-incrementing version column in your database tables that detects concurrent update conflicts. You'll find configuration best practices, troubleshooting steps, and version-specific notes here.Intershop Support Portal & Knowledge Base
If you're a customer or partner, the support portal has in-depth articles on lock performance tuning, resolving deadlock issues with pessimistic locks, and real-world use cases from other Intershop developers.Core Code Exploration
Dig into Intershop's source code under thecom.intershop.beehive.persistence.lockpackage. Classes likeOptimisticLockHandlerandPessimisticLockHandlershow the exact logic behind each lock type. You'll also see how entities with@Versionannotations map directly to the OCA database fields.Intershop Community Forums
Connect with other Intershop devs in the official community forums. People often share war stories about lock configuration in high-traffic environments, and you can get answers to niche questions that aren't covered in the standard docs.
内容的提问来源于stack exchange,提问作者mihallievich

