Currently my company is developing a web based application using the JBoss-2.4.3_Tomcat-3.2.3 combined container. All of our entity and session beans are running under CMP. The problem we are running into is that some of our processes are running into application deadlocking due to two session beans trying to access entity beans in reveres sequence (i.e. session bean one accesses entity bean A then B while session bean 2 accesses entity bean B then A). To remedy this problem we have tried the following solutions to no avail:
1) Changed setting of session bean 2 so it was not running under a transaction (NotSupported and event tried Never).
2) Changed all session beans to BMP (this resolved deadlocking, but then no transactions were propagating - a bad thing).
I have seen several posts on this site about similar problems and others feel that this all stems from JBoss's pessimistic locking of entity beans, even those not within a transaction. Some users have suggested deploying two sets of entity beans, read only and updateable. My question is this, how exactly would you go about deploying two versions of entity beans pointing to the same records in the database, and second, are read only beans subject to pessimistic locking?
One thing we are also considering is having two sets of session controller beans. One set would be under BMP and would provide read only access to entity beans, while the other set would be CMP and would be involved in updating actions. I think this would get around the pessimistic locking and deadlocking issues, but there must be a better way.
Anyone (especially the developers) have any thoughts and ideas on all of this?