Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1887

hardeployer should provide capability of setting TrasactionFactory attribute

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Obsolete
    • Icon: Major Major
    • No Release
    • JBossAS-4.0.2 Final
    • JPA / Hibernate
    • None
    • mysql 4.1.11 as the datasource, hibernate service driving web application inside an EAR

    • Compatibility/Configuration

      I would like to use Hibernate transactions in my code, since I need to run it stand-alone as well as inside JBoss. To support this, I need to use the org.hibernate.transaction.JDBCTransactionFactory, so I'd like to be able to configure the mbean like this (note last attribute is NOT supported by current hardeployer):

      <server>
      <mbean code="org.jboss.hibernate.jmx.Hibernate" name="jboss.har:service=PdbHibernate">
      <attribute name="DatasourceName">java:jdbc/OrMappingDS</attribute>
      <attribute name="Dialect">org.hibernate.dialect.MySQLDialect</attribute>
      <attribute name="SessionFactoryName">java:/hibernate/PdbFactory</attribute>
      <attribute name="JdbcBatchSize">100</attribute>
      <attribute name="MaxFetchDepth">3</attribute>
      <attribute name="ShowSqlEnabled">true</attribute>
      <attribute name="TransactionStrategy">org.hibernate.transaction.JDBCTransactionFactory</attribute>
      </mbean>
      </server>

      I noticed in the source code (see below) that you look in the environment for TRANSACTION_STRATEGY, but I'm not sure if I, as a user, can set that varaiable (is it an operating-system environment var? or a java -D var?) but anyway it would be nice to be able to configure it from the hibernate-service.xml

      setUnlessNull(props, Environment.TRANSACTION_STRATEGY, JTATransactionFactory.class.getName());

      The code I'm using in my web app looks like:

      org.hibernate.Transaction tx = null;
      try
      {
      s = HibernateUtils.getSession();
      tx = s.beginTransaction();
      while (li.hasNext())

      { LoadResult lr = (LoadResult) li.next(); s.save(lr); }

      tx.commit();
      s.close();
      }
      catch (Exception e)

      { if (tx != null) tx.rollback(); HibernateUtils.HandleHibernateException(s, e); }

              Unassigned Unassigned
              townsendmerino_jira wayne townsend-merino (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 1 day
                  1d
                  Remaining:
                  Remaining Estimate - 1 day
                  1d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified