I am admittedly an EJB noob and hope you will please find a minute for this question. I have deployed an app with two message-driven beans to JBoss AS 7.1.1.Final. The first MDB creates an entity and persists it, then puts a message on a JMS queue with the entity key. The second MDB reads the message looks up the entity using the key .. and usually, but NOT always, finds it. I can see the row in the database when all the shouting is over. The first MDB does not call the entity manager's flush() method, altho I experimented with that, no improvement. Is there some basic fundamental pattern that I'm violating here? Thanks, look forward to learning something here.
I should have mentioned that the database is set up as READ COMMITTED. And the solution to the problem seems to be in managing transactions appropriately. The solution I found for MDB1, the one that creates an entity and sends a message, was to have it call a method to create the entity (instead of using the entity manager directly). Critically, that method is annotated to require a new transaction. Hope this helps someone out there.
|Retrieving data ...|