2

hello all i am using hibernate using jpa in my project and accessing dao's like new (dao name).(methdoname)... eg. new OrdersDao().createOrder() so i would like to ask you is it a good practice to use it this way..or if something else then please suggest me...i am asking this question as after few clicks for navigation in my application i am getting message of connection and application gets crashed .. the error is like below. WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ mypoolname ]. Reason : com.sun.appserv.connectors.in``ternal.api.PoolingException: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections. WARNING: RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.]

SEVERE: java.lang.IllegalStateException: Transaction not active

this is my persistence.xml file...


<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence         http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0"> 
<persistence-unit name="mypu" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<non-jta-data-source>myjndi</non-jta-data-source>
<properties>
<property name="datanucleus.storeManagerType" value="true" />
<property name="hibernate.bytecode.use_reflection_optimizer"
value="false" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
user1918096
  • 153
  • 1
  • 3
  • 10
  • can you share your dataSource configuration – NPKR Jan 07 '13 at 05:59
  • public class EntityMgrFactory { static EntityManagerFactory entityManagerFactory= Persistence.createEntityManagerFactory("mypersistenceUnit"); public static EntityManagerFactory getEmf(){ try{ return entityManagerFactory; }catch(Exception e){ e.printStackTrace(); } return null; } } – user1918096 Jan 07 '13 at 06:28

0 Answers0