При попытке установить блокировку (пессимистично) со следующим кодом:
em.lock(controlnumbers, LockModeType.WRITE);
em.refresh(controlnumbers);
Я получаю следующее исключение:
[#|2009-09-10T15:42:48.324-0400|INFO|sun-appserver2.1|javax.enterprise.system.container.ejb|_ThreadID=31;_ThreadName=httpSSLWorkerThread-8080-19;|
javax.ejb.TransactionRolledbackLocalException: Exception thrown from bean; nested exception is: javax.persistence.PersistenceException: ejb30-wrong-lock_called_without_version_locking-index (There is no English translation for this message.)
javax.persistence.PersistenceException: ejb30-wrong-lock_called_without_version_locking-index (There is no English translation for this message.)
at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerImpl.lock(EntityManagerImpl.java:619)
at com.sun.enterprise.util.EntityManagerWrapper.lock(EntityManagerWrapper.java:582)
at com.eximtechnologies.transactionserver.persistence.session.ControlNumbersFacade.lock(ControlNumbersFacade.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Как мне реализовать пессимистическую блокировку в Glassfish 2.1?