I need to clarify some of my doubts related to eclipselink locking.
How can i configure eclipselink that a row level lock should be held rather than a table level? I'm using spring transactions and havn't touched any configurations related to locking in eclipselink, so it uses default locking (optimistic). Please correct me if i'm wrong here.
I have added @Version column in my entity classes to support locking mechanism. Is this a good way or do i have to use the Locking API in code too like entityManager.lock or @Lock etc? Should i use these locks in code even when i have configured database transactions through spring? I'm confused with the usage of code level locking and declarative transaction management.
Row versus table locks are up to your database, and can only be configured on your database. You can execute a native SQL query if you really want to lock an entire table, although not normally a good idea.