[jboss-user] [EJB 3.0] - Issues with EJB 3 CMP while migrating to jboss-eap-5.0.1

Praveen Ramisetty do-not-reply at jboss.com
Wed Oct 13 07:13:08 EDT 2010


Praveen Ramisetty [http://community.jboss.org/people/praveen_ramisetty] created the discussion

"Issues with EJB 3 CMP while migrating to jboss-eap-5.0.1"

To view the discussion, visit: http://community.jboss.org/message/566241#566241

--------------------------------------------------------------
we observed some issue in our Application while migrating Jboss 4.0.4 to Jboss-EAP-5.0.1.  We are using Containter-Managed Persistence in my project and causing issues when performing Asynchronous transactions (JMS).

Before sending message to JMS Queue, my application making an entry in the database. After persisting the record, It sends the Primary Key along with the JMS message.

In message Driven bean we trying to find the same record using the primary key that we received throught the jms message and failing intermittently. As we are making bulk operation we are able to find the record for some transactions and for some tasks the operation is getting failed.

Jboss CMP not persisting the data before sending the message to queue and causing the issue. The code works fine with jboss 4.0.4 but failing with jboss-eap-5.0.1. please give ur suggestions or do i need to do any changes more. Thanks in Advance.

@Stateless
@Remote({MySession.class})
public class MySessionBean implements MySession{

@PersistenceContext (unitName="MyApplication")
    private EntityManager manager;

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public long doSwitchBackhaul(<parameters>){
     ArrayList<Task> taskIdList = createTaskObject();
     scheduleTaskViaJMS(taskIdLIst);
}


@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public ArrayList<Task> createTaskObject(<parameters>){
     Batch batch = createBatchObject();

     for each listof tasks{
          <Code to create Task object>
          <pass the batch id to Task>
          manager.persist(Task)
          manager.flush();
     }

     return ArrayList<Task> object;
}

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public Batch createBatchObject(<parameters>){
     <Code to create Batch Object>
     manager.persist(Batch);
     manager.flush();
     return Batch;
}

public void scheduleTaskViaJMS(jbolist){

     <code to send the message along with task id to queue>

}

}

@MessageDriven (
    activationConfig=
    {
        @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
        @ActivationConfigProperty(propertyName="destination", propertyValue="queue/ProvGuiJobs1")
    }
)
public class MDB1 implements MessageListener{
     @PersistenceContext (unitName="MYApplication")
    private EntityManager manager;

     public void onMessage(Message message) {
          Task task = manager.find(Task.class, list.getTaskId()); //Issue is here.. I m not getting all task for few transactions     
          <do changes to task object>
          manager.persist(task);
          manager.flush();
     }
}
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/566241#566241]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101013/9257faa3/attachment-0001.html 


More information about the jboss-user mailing list