Duvida JPA com pool de conexão

Olá,

minha duvida pois estou com problema de como administrar as conexões de um sistema
onde estou usando JPA com Hibernate …não tenho experiência

Duvidas como configurar qual melhor configuração ???

Hoje tive um problema no sistema onde deu o seguinte erro :

Se alguem puder me ajudar e como acesso o persistence.xml está baixo se tiver jeito melhor de configurar agradeceria exemplos ou url ???

abs


javax.servlet.ServletException: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Cannot open connection
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:515)

meu xml está assim

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
         <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
         <property name="hibernate.connection.url" value="jdbc:mysql://localhost/banco"/>
         <property name="hibernate.connection.username" value="root"/>
         <property name="hibernate.connection.password" value="root"/>
         <property name="hibernate.show_sql" value="true" />  
         
         <property name="hibernate.c3p0.min_size" value="0"/>
         <property name="hibernate.c3p0.max_size" value="10"/>
         <property name="hibernate.c3p0.timeout" value="1000"/>
         <property name="hibernate.c3p0.max_statements" value="50"/>
         <property name="hibernate.c3p0.idle_test_period" value="3000"/>
         <property name="hibernate.c3p0.acquire_increment" value="2"/>  

public AbstractBaseDao() {
		
		bMANAGER = DATAS.getInstance();
		System.out.println("Conteudo Construtor() AbstractBaseDao = "+bMANAGER);
	}

 public void persist(T t) throws DaoException {
    	try {
    		
    		bMANAGER.BeginTransaction();
    		bMANAGER.getManager().persist(t);
    		bMANAGER.CommitTransaction();
    	} catch(Exception e) {
    		throw new DaoException(getErrorCode(METHOD_PERSIST), "Can not insert", e);
    	}finally{
    		bMANAGER.Close();
    	}
    }
-----
 public void merge(T t) throws DaoException {
    	try {
    		bMANAGER.BeginTransaction();
    		bMANAGER.getManager().merge(t);
    		bMANAGER.CommitTransaction();
    	} catch(Exception e) {
    		throw new DaoException(getErrorCode(METHOD_MERGE), "Can not update", e);
    	}finally{
    		bMANAGER.Close();
    	}
    }
---
 public T find(T entity) throws DaoException {
    	T t = null;
    	try {
    		t = bMANAGER.getManager().find(domainClass, entity);
    		return t;
    	} catch(Exception e) {
    		throw new DaoException(getErrorCode(METHOD_FIND_BY_CLASS), "Can not find by Class", e);
    	}finally{
    		bMANAGER.Close();
    	}
    }


----

public class DATAS {
    
    protected String bDatabase = "banco";	

    protected EntityManagerFactory factory     = Persistence.createEntityManagerFactory(bDatabase);
    protected EntityManager        manager     = factory.createEntityManager();
    private   EntityTransaction    transaction = null;

    private static DATAS instance = new DATAS();   

    private DATAS(){
    }
    
    public static DATAS getInstance() {   
    	return instance;   
    }   

    public EntityManager getManager() {
    	return this.manager;
    }
    
    public void BeginTransaction()
    {
    	transaction = manager.getTransaction();
    	transaction.begin();
    }
    
    public void CommitTransaction()
    {
    	transaction.commit();
    }

	public void RollBackTransaction() {
		transaction.rollback();
	}    
	
	public void Close() {
		manager.close();
		factory.close();
	}    
}

Dúvida tirada em: http://www.guj.com.br/posts/list/0/114444.java#619228