[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Hibernate, jBoss Portal, jta?

thinwath do-not-reply at jboss.com
Thu Aug 13 11:42:11 EDT 2009


Hi guys, 

I'm facing a problem and don't rly know what I'm doing wrong. Scenario: I got serveral portlets deployed on my jBoss Portal 2.7.0 those are using hibernate to access a DB2 database, there is one servlet which provides a PDF generation this needs access to the database. 

I'm managed to look up for the jndi bound Hibernate SessionFactory but sometimes, it doesn't appears evertime I get this exception

I'm not sure if switching my current_session_context_class to jta fix this problem?

17:32:37,059 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: null
  | 17:33:06,358 ERROR [JDBCExceptionReporter] Connection is not associated with a managed connection.org.jboss.resource.ada
  | pter.jdbc.jdk5.WrappedConnectionJDK5 at 11a0267
  | 17:33:06,362 INFO  [DefaultLoadEventListener] Error performing load command
  | org.hibernate.exception.GenericJDBCException: could not load an entity: [de.test.hibernate.P11000#72110]

Maybe someone could give me hand on this? Below are my datasource xml and my hibernate cfg

datasource.xml
<local-tx-datasource>
  |     <jndi-name>DB2-test</jndi-name>
  |     <connection-url>jdbc:as400://ip/SCHEMA1;extended dynamic=true;package=jbpkg;package cache=true;package library=jboss;errors=full</connection-url>
  |     <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
  |     <user-name>user</user-name>
  |     <password>pw</password>
  |     <min-pool-size>1</min-pool-size>
  |         <check-valid-connection-sql>SELECT current date FROM sysibm.sysdummy1 </check-valid-connection-sql>
  | 
  |       <metadata>
  |          <type-mapping>DB2/400</type-mapping>
  |       </metadata>
  | 
  |   </local-tx-datasource>

hibernate.cfg.xml
<hibernate-configuration>
  |  <session-factory name="java:GmDb2SessionFactory">
  |   
  |   <property name="hibernate.connection.driver_class">com.ibm.as400.access.AS400JDBCDriver</property>
  |  
  | 	<property name="hibernate.connection.datasource">java:comp/env/jdbc/DB2-test</property>        
  |   <property name="hibernate.connection.autocommit">false</property> 
  |   <property name="hibernate.default_schema">MISDTA</property>
  |   <property name="hibernate.dialect">org.hibernate.dialect.DB2400Dialect</property>
  |   <property name="hibernate.connection.charset">UTF-8</property>
  |   <property name="hibernate.current_session_context_class">thread</property>
  |   <property name="hibernate.show_sql">false</property>
  |   <property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>
  |   <property name="hibernate.cache.use_query_cache">true</property>
  |   <property name="hibernate.connection.release_mode ">after_statement</property>
  | <mapping resource="..." />
  |  </session-factory>
  | </hibernate-configuration>
  | 
  | Thanks in advance

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

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



More information about the jboss-user mailing list