I have one session facade routing requests from a servlet
to a CMP entity bean. The entity bean selects the least hit record and hands out the contents of an image-location field in that record and increments a counter field in the same record. This involves executing a finder, calling the counter field's getter and setter.
What I would like is for those three calls to be treated atomically and for that transaction to be properly isolated.
So, what you are saying is my container has assigned multiple entity bean instances(each of which represents the same db row and a different client request) to a single EJBObject. And the container is doing the synchronizing of access to the db record based on the level of isolation defined by its tools. Is this correct?
All I should have to do is to provide an appropriate level of isolation (and perhaps choose optimistic or pessimistic locking once I'm happy with my performance-to-data-integrity-preservation tradeoff). Is this correct?
As far as I can tell, the isolation level I want is REPEATABLE_READ or SERIALIZABLE. If I understand correctly, one of these would give me a high degree of data integrity but might impact severely on performance. Is this correct?
Any help is much appreciated.