Hibernate version: 2.1.8
Mapping documents: *** hibernate-service.xml ***
<server> <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=wmsHibernate"> <depends>jboss.jca:service=LocalTxCM,name=OracleDS</depends> <attribute name="SessionFactoryName">java:/ora/SessionFactory</attribute> <attribute name="DatasourceName">java:/OracleDS</attribute> <attribute name="Dialect">net.sf.hibernate.dialect.Oracle9Dialect</attribute> <attribute name="MaxFetchDepth">3</attribute> <attribute name="ReflectionOptimizationEnabled">true</attribute> <attribute name="QueryCacheEnabled">true</attribute> <attribute name="ShowSqlEnabled">false</attribute> <attribute name="JdbcBatchSize">25</attribute> <attribute name="JdbcScrollableResultSetEnabled">true</attribute> <attribute name="CacheProviderClass"> net.sf.hibernate.cache.HashtableCacheProvider </attribute> </mbean> </server>
*** oracle-ds.xml ***
<datasources> <local-tx-datasource> <jndi-name>OracleDS</jndi-name> <connection-url>jdbc:oracle:thin:@192.20.10.01:1521:MYSID</connection-url> <driver-class>oracle.jdbc.driver.OracleDriver</driver-class> <user-name>sys</user-name> <password>admin</password> <min-pool-size>5</min-pool-size> <max-pool-size>50</max-pool-size> <blocking-timeout-millis>50000</blocking-timeout-millis> <idle-timeout-minutes>1</idle-timeout-minutes> <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name> <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name> <metadata> <type-mapping>Oracle9i</type-mapping> </metadata> </local-tx-datasource> </datasources>
Code between sessionFactory.openSession() and session.close(): boolean user_found = false; Session session = null; try { session = new ContextResources().getHibernateFactory().openSession(); Query query = session.createQuery("from TerminalUser as tu where tu.TuPassword = :paswd "); query.setParameter("paswd",passwd); Iterator it = query.iterate(); while(it.hasNext()) { TerminalUser tu = (TerminalUser)it.next(); if ((tu.getId().getEmployeeId()).equalsIgnoreCase(uname)) { user_found = true; } } session.close(); //Setting session to null, just in case... session = null; } catch(Exception e) { e.printStackTrace(); //DEBUG try {session.close();session = null;}catch(Exception e1) {} throw new DataBaseException(); }
Name and version of the database you are using: Oracle 9i v9.2.0.1.0
JBoss version: 4.0.1sp1
Hibernate tool: Hibernate Synchronizer
The code above is used inside a stateless session EJB.
It appears that even by calling session.close() the DB connection used does not return to the connection pool. I've also tried getting a connection directly from the connection pool and provide it to hibernate (in openSession() method), but no luck. My pool is only getting smaller...
Any thoughts on what I might be doing wrong?
|