posted 13 years ago
Hi everyone , i have a problem persisting to the database using jpa . I am getting this exception 11:32:09,508 ERROR [JDBCExceptionReporter] ORA-02049: timeout: transacci¾n distribuida esperando bloqueo
I have two entities with the following code:
The other entity is
This is where i persist
What i basically do here is :
1. populate and persist a Reintegro type object , so as to get a sequence number (idReintegro) from a sequence generator
2. find and persist other entities (No problem here)
3. Take the sequence obtained in step 1 (idReintegro) , assign it to aportePortafolioDos object (foreign key value)
4. Persist the aportePortafolioDos object
The thing is that once the persistence context is synchronized with the Oracle 11g database , it hangs for a few minutes and then throws the exception ORA-02049: , which indicates there is a lock . The lock occurs while trying to persist aportePortafolioDos on an insert statement.
If I disable the foreign key on the table mapped by AportePortafolioDos , everything works as expected . but if the foreign key is active then i get the deadlock.
I have been trying to find a solution for days , to no avail. Is there anything to do at all ? Please help!!!