I have a entity manager em1 .em1 starts a transcation tx on db1 table1.Now inside tx i call a API getdata().This API creastes a new entitymanger em2 and return 1 record.Now if entity manger em1 tries to delete the record returned by em1 , it hangs.Code times out.Is the record locked by em1.How can ii solve this problem?
create em1
//em1 start transcation tx1
tx1.start
Object r = getData();
em1 tried to delete r //code hangs here
tx1.commit
Object getData(){
create em2
return data found using em2
}
Don’t create an em2. Pass the em1 as a parameter to
getData()method. Doing so, you’re operating only one em1.I don’t know exactly, but it seems that em1 is putting lock on the related table, so you can’t do anything outside.