[jboss-user] [EJB 3.0] - Performance question on EntityManager

akrishmohan do-not-reply at jboss.com
Wed Dec 6 00:17:51 EST 2006


Hi All

I have a scenario and am trying to evaluate the performance of using the entity manager in a Message Driven Bean (MDB) 

class MDBean {
@persistencecontext(....)
private EntityManager em;

public void onMessage() {
....
while (someCondition) {
  ClassB b = new ClassB();
  b.setEntityManager(em);
  b.doSomething();
}
............
}

Basically ClassB carries out persisting of about 6 tables based on the entitymanager passed to it. This process happens in a loop and the loop runs for about 10 - 20 times. I was wondering if I need to close the entity maanger at some point and re-create it? What would be the performance hit if any? Let me know what other design considerations need to be taken into account? 

Thanks
K

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3991534#3991534

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3991534



More information about the jboss-user mailing list