[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - SessionException: session closed after very large native que

jantzen do-not-reply at jboss.com
Tue Jan 23 02:22:08 EST 2007


Hi All,

I've got a PostgreSQL 8.1 database that I'm performing a series of large queries on under JBoss 4.0.5, and the EntityManager is closing after each query such that the next fails.  The queries are native SQL, and return in excess of 250,000 rows.

The datasource is defined as non-transactional to avoid transaction timeouts:

  |   <no-tx-datasource>
  |     <jndi-name>MyDB</jndi-name>
  |     <connection-url>jdbc:postgresql://localhost:5432/MyDB</connection-url>
  |     <driver-class>org.postgresql.Driver</driver-class>
  |     <user-name>...</user-name>
  |     <password>...</password>
  |   </no-tx-datasource>
  | 

And a suspect persistence unit:


  |   <persistence-unit name="MyDB">
  |     <provider>org.hibernate.ejb.HibernatePersistence</provider>  
  |       <jta-data-source>java:/MyDB</jta-data-source> 
  |       <properties>
  |         <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> 
  |         <property name="hibernate.show_sql" value="false" />   
  |       </properties>
  |   </persistence-unit>
  | 

The thing that's suspect here is the jta-data-source element, when I need this datasource not to be transactional, and I should be using non-jta-data-source.  Unfortunately, there's a bug that prevents me from doing that (http://jira.jboss.com/jira/browse/EJBTHREE-433) 

The EntityManager is injected by JBoss using PersistenceContext, and what I find is that the first query to run will succeed, and get through all of the expected data, but the next query to run will generate a SessionException because the EntityManager is getting shutdown somewhere.

So, has anyone else encountered this kind of behavior?  Is it likely due to the jta-data-source declaration?

Thanks.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4005183#4005183

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4005183



More information about the jboss-user mailing list