2 Replies Latest reply on Jul 31, 2008 4:11 AM by Carlo de Wolf

    Problem with EJB3 MDB, & Entity Objects

    Scott Everts Newbie

      I am having a problem with a project that I am currently working on. I have a process that imports a datafile which goes like:
      1. a SAR detects the file is present
      2. the SAR will then send a JMS message to the MDB
      3. the MDB receives the message and then parses / imports the data creating Entity objects etc.
      4. when the MDB has imported all of the records it then sends a list of IDs to the next MDB which would need to process it and so on.

      Here's the problem. I import all of the records in basically the OnMessage function of the MDB using a couple of helper classes. When I go to send the message to the next MDB, the "NEXT" MDB receives the message looks up the entity by the ID provided in the message and it's not in the database even though we persisted it in the "FIRST" MDB... Even if in the "FIRST" MDB I call entityManager.Flush () and then EntityManager.Clear() it still has the same problem

      Am I not using EJB correctly, should the MDB be using some other EJB object to process / import the records?

      Any thoughts?

      Thanks in advance,

      Scott