Hi,
I realise that JPA2 doesn't necessarily define a standard API way for Lock Timeouts. However, there is a standardised query 'hint' that can be setup to make the underlying DB lock a record for a specific time. The hint property is: "javax.persistence.lock.timeout"
I have a situation where multiple threads can hit a shared counter (which is used to track separate customers product index) - and my test case is failing here. The issue is that once the pessimistic lock is in place on the record, a subsequent access (which is a valid scenario for me) would instantly throw a:
com.objectdb.o._LockTimeoutException: Write lock cannot be granted for a.b.c.d.EE#150. irrespective if I set it at '0' all the way to '10000' (10 seconds) I can't accomplish this. The ideal case would be that the current application method 'sleep' until the lock is released. Is this possible? I realise setting a shared lock in the EJB could get around this, but this would be global and impact all threads.
My situation is where many clients from 1 company are accessing the same counter when bulk uploading products.