0 Replies Latest reply on Jan 13, 2006 7:33 AM by alban_coul

    hibernate jboss configuration help, production problems

    alban_coul

      Post

      Install : Oracle 9i - Jboss 4.0.2 - Hibernate 3.0.5 - JDK1.5
      we have got many application in production. These are packaged as wars. Here is our configuration.


      OracleDS:


      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@xxx:1521:xxx</connection-url>

      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>xxx</user-name>
      xxx

      <min-pool-size>0</min-pool-size>

      <max-pool-size>30</max-pool-size>

      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>


      <type-mapping>Oracle9i</type-mapping>

      </local-tx-datasource>



      hibernate.cfg.xml:

      <hibernate-configuration>
      <session-factory>

      <!-- datasource connection properties -->
      java:/OracleDS

      <!-- dialect for Oracle 9 -->
      org.hibernate.dialect.Oracle9Dialect

      false
      org.hibernate.transaction.JBossTransactionManagerLookup

      </session-factory>
      </hibernate-configuration>

      Fecth the session factory:

      private Session newSession() {
      synchronized (configuration) {
      if (sessionFactory == null) {
      if (logger.isInfoEnabled()) {
      logger.info("HiberConf - initialize sessionFactory");
      }

      sessionFactory = configuration.buildSessionFactory();
      }

      return sessionFactory.openSession();
      }
      }

      And DefaultDatasource is set to OracleDS in the standardjbosscmp.xml.

      No Hibernate Mbean added in JBoss...

      Here is an example of request :


      public List getAgentsParResponsableProjet(Integer idResponsable) {
      List agents = null;
      Transaction tx = null;
      synchronized (this) {
      try {
      session = HibernateUtil.currentSession();
      tx = session.beginTransaction();
      agents = session.createQuery(
      "from ActiviteAffectee aa where aa.Idresponsable='" + idResponsable.toString() + "'")
      .list();
      tx.commit();
      } catch (Exception ex) {
      if (tx != null) {
      tx.rollback();
      }
      if (log.isErrorEnabled()) {
      log.error("getAgentsParResponsableProjet", ex);
      }
      } finally {
      HibernateUtil.closeSession();
      }
      }
      return agents;
      }



      We are just wondering if we have got the right configuration for the couple JBoss-Hibernate.
      Because we have got stranges errors like synchronisation of TransactionManager the are happening sometimes.
      We really need help cause these apps are in production and we couldn't make a test period for these apps...

      Thanks in advance