Hi,
I have created an EJB 3.0 application that consists of EJBs and JSP pages. I have a
problem where a call to EntityManager.flush in a stateless session bean seems to be
ignored. Here is what is happening:
A timer kicks off a stateless session been every X minutes. This bean does some work,
sends an HTTP POST to another server and then logs an entry in an Oracle database that
records that it sent the POST. This is done in a loop that could run 10 times, or
hundreds of times. So every iteration of the loop makes an HTTP POST and creates 1
database record. After the end of each iteration I am calling flush to (try) and force
the record to be written out to Oracle, and not just stored in JBoss? cache.
While the above loop is running, the server I sent the HTTP POST to in the loop above
starts connecting to a JSP page I have created to say that it completed the work I sent
it. The JSP page uses another stateless session bean, which looks up the database record
created in the loop by its primary key and attempts to update it. The problem I am having
occurs here. If the method with the loop above is still running, the database record is
not found.
So JBoss is not storing the record in Oracle until the method completes, even though I am
calling flush. And since my lookup for the record is based on its primary key, JBoss
doesn?t check its cache but goes directly to the database (according to the docs I read
anyway).
I am using JBoss 4.0.4. Does anyone have any tips or ideas as to how I can overcome this?
Thanks!
DaHunter
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063504#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...