-->
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.  [ 2 posts ] 
Author Message
 Post subject: JPA J2SE connection pooling.
PostPosted: Mon Aug 25, 2008 5:39 pm 
Newbie

Joined: Fri Aug 08, 2008 6:43 am
Posts: 3
Hello,

What is the right way to do connection pooling in a J2SE environment with JPA.

I know the normal way to get an EntityManager and that it is not thread save:
Code:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("PUnit", new java.util.HashMap());
        EntityManager em = emf.createEntityManager();


Unfortunately I couldn't find much more about connection pooling.

Any pointers are appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 27, 2008 10:48 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

I do not understand what your example has to to with connection pooling, but generally the question is in which environment you are running. If, for example, you are using JPA within a managed container and the access to the datasource is via a JNDI setup, then it is a question of configuring the container managed datasource properly in order to use a connection pool. If you are not running within a container or you want to manage your connection pooling via hibernate you can just add the appropriate hibernate configuration options to you config file. Have a look at this: http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#configuration-hibernatejdbc.

Hope this helps.

--Hardy


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

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.