Hello,
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
objects
Broker
public class Broker {
private EntityManagerFactory factory;
private EntityManager em;
private static Broker instance = new Broker();
public Broker() {
factory = Persistence.createEntityManagerFactory("myFactory",
System.getProperties());
em = factory.createEntityManager();
}
public static Broker getInstance() {
return instance;
}
.....
public List<Segment> getAllSegments() {
Query q = em.createQuery("SELECT segment FROM Segment segment
ORDER BY
segment.name");
return (List<Segment>) q.getResultList();
}
--
View this message in context:
http://openjpa.208410.n2.nabble.com/OpenJPA-is-a-J2EE-Container-Architecture-tp5362389p5366179.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.