We are using Seam / Hibernate with container managed transactions. This sequence of events occur:
1) A web service is activated, persists stuff and sends the ID of a newly persisted item with a JMS message.
2) The receiver of the JMS message tries to look up the item and fails. It seems that the first action is not yet committed.
I'm fairly certain that this is, what is happening (the scenario is much more complex) since JMS resending later may succeed, and because a sleep in phase 2 removes the problem.
I had hoped that JBoss would commit the first phase together with the JMS message before actually sending the message (and start the new thread).