-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Running into no connections
PostPosted: Thu Apr 02, 2009 2:24 pm 
Newbie

Joined: Thu Apr 02, 2009 1:54 pm
Posts: 2
Hi All,

I am using JPA in my application. I am trying to understand the relation between EntityManager and Connection. When I am executing a large transaction I am getting the "Could not open connection" sort of exceptions

My code looks like below

public class MyPersistence
{
private EntityManager em;

MyPersistence(EntityManager em)
{
this.em = em;
}

public void add(Object obj)
{
em.persist(obj);
}

public Object update(Object obj)
{
return em.merge(obj);
}

public void delete(Object obj)
{
em.remove(obj);
}
}

@Stateless
public class MySessionBean
{

@PersistenceContext
private EntityManager em;

public void doBusiness()
{
CustomObect obj = new CustomObect();
MyPersistence persistence = new MyPersistence(em) ;
persistence.add(obj);
obj = persistence.update(obj);
persistence.delete(obj);
em.flush();
}
}

when I invokes doBusiness() method from MySessionBean total how many connections will be opened and when will they closed.

I really appreciate if someone can helps me.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.