Here's my environment....
I have a stateful session EJB updating a database via one instance of DAO class. I also have a servlet updating the same database via the a different instance of the same DAO class. The DAO class is written in such a way that it obtains a connection object in its constructor and retains this reference until it is instructed to close the connection. It is also written to allow the servlet to specify that it needs to explicitly commit and rollback transactions.
I am running under JBoss 2.4.3 with Tomcat 3.2.3 against a Microsoft Access database. I know this is a horrible configuration because it is long out-of-date but unfortunately I cannot upgrade for this particular situation.
The behavior that I am seeing is that some updates via the EJB are seen by the EJB (i.e., I call into the EJB and make an update then I call into it again to retrieve the information and I see the changes made) but not by the servlet (i.e., After the update has been made by the EJB and the EJB transaction is complete, the servlet when trying to retrieve the information does not see the changes).
Does anyone know if this is valid behavior based on what containers are instructed to support by the EJB and servlet specifications? Or, does it sound like it is the result of a bug in either JBoss, Tomcat or Access? Does anyone know for sure and/or have any suggestions?
Does anyone know if there is a more proper way to update the database or a work around for this? The reason for the servlet is that *many* database reads and updates are being made to data on a web page and going thru the normal channels (front controller -> ui controller -> ejb -> database) would kill performance. However, there are a few functions that must go thru the normal channels but that also require updating the data in the database. My current work around is to have the ejb call the servlet to perform the database update. This works but is not as reliable because it is not transactional...once the call to the servlet returns, if a problem occurs and state needs to be rolled back, the database updates cannot be rolled back automatically.
Thanks for any and all help!