openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsloyer <>
Subject Re: OpenJPA is a J2EE Container - Architecture
Date Mon, 02 Aug 2010 22:27:19 GMT


I am using WebSphere Application Server.  When a request comes to a servlet,
the servlet calls my Broker Class.  Inside the broker class I have the
entity manager and some transaction (below).  I am running into issues where
multiple transactions are going on at once.  How can I fix this?

Call from the servlet.
Broker.getInstance().getAllSegments();  //this returns a list of POJO

public class Broker {
	 private EntityManagerFactory factory;
	 private EntityManager em;
	 private static Broker instance = new Broker();
	 public Broker() {
	     factory = Persistence.createEntityManagerFactory("myFactory",
	     em = factory.createEntityManager();
	 public static Broker getInstance() {
	     return instance;

public List<Segment> getAllSegments() {
		 Query q = em.createQuery("SELECT segment FROM Segment segment ORDER BY");
		 return (List<Segment>) q.getResultList();
View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message