Open Locks in optimistic locking bug !!!
Yes it is possible, it was happening in our application and could not imagine why.
After research we found out that it was in the CustomDBTransactionImpl.
We use it to override doCommit in order to do staff after all data are posted but not yet committed according to :
Fusion Developer's Guide for Oracle ADF, D ADF Equivalents of Common Oracle Forms Triggers:
POST-FORMS-COMMIT
Execute code after Forms has "posted" all necessary rows to the database, but before issuing the data commit to end the transaction
If you want a single block of code for the whole transaction, you can override the doCommit() method in a custom DBTransactionImpl object and write code before calling the super.
I managed to reproduce it in a simple test case.
I just have Departments entity and view and an application module with CustomDatabaseTransactionFactory. In CustomDBTransactionImpl I override doCommit and throw an exception:
@Override
protected void doCommit() {
if (true){
throw new JboException("Exception in doCommit");
}
super.doCommit();
}
I run the application, make a change and press commit. I get the error:

Now the row is locked in the database!!!!
I run a new instance of the application i make a change and try to commit and I get:

If I try to do rollback before I throw the exception then the locks are lost of course but also all the changes made on page.
Is this a bug?
If not, is there an other way to check and throw exception, after data are posted to database and before commit, without locking?