Here is my settings:

<hibernate-configuration>

  <session-factory name="java:comp/env/jndi/HibernateSessionFactory">

    <property
name="connection.datasource">java:comp/env/jdbc/xa/postgresql/somedb</pr
operty>
    <property
name="dialect">cirrus.hibernate.sql.PostgreSQLDialect</property>

    ... mapping files ...

    </session-factory>

</hibernate-configuration>

hibernate.use_outer_join=true
hibernate.show_sql=false
hibernate.jdbc.batch_size=10
hibernate.statement_cache.size=20
hibernate.transaction.factory_class=cirrus.hibernate.transaction.JTATran
sactionFactory
hibernate.transaction.manager_lookup_class=cirrus.hibernate.transaction.
ResinTransactionManagerLookup
hibernate.query.substitutions yes 'Y', no 'N'
jta.UserTransaction=java:comp/UserTransaction


I start transaction with this code:

Session session = null;
cirrus.hibernate.Transaction tx = null;

try {

  if (log.isDebugEnabled())
    log.debug("Getting Hibernate session.");

  session = this.sessionFactory.openSession();

  if (log.isInfoEnabled())
    log.info("Starting database transaction.");

  tx = session.beginTransaction();

And I end the transaction like this:

  if (log.isInfoEnabled())
    log.info("Committing database transaction.");

    tx.commit();

    if (log.isInfoEnabled())
      log.info("Database transaction committed successfully.");

  } catch (SQLException e) {
    log.error(e);
    this.rollbackTransaction(tx); // just an exception handling helper
func
    throw new ServletException(e);
  } catch (HibernateException e) {
    log.error(e);
    this.rollbackTransaction(tx); // just an exception handling helper
func
    throw new ServletException(e);
  } catch (Exception e) {
    log.error(e);
    this.rollbackTransaction(tx); // just an exception handling helper
func
    throw new ServletException(e);
  } finally {

    try { session.close();
    } catch (SQLException e) {
    } catch (HibernateException e) {}

    if (log.isDebugEnabled())
      log.debug("Closed Hibernate session.");
  }
}

Everything goes fine until finally block. It gives me warnings:

21:35:24,381 WARN  [JDBCExceptionReporter] SQL Warning: 0, SQLState:
null
21:35:24,381 WARN  [JDBCExceptionReporter] WARNING:  COMMIT: no
transaction in progress

What causes these? Am I doing something wrong? If I tx.commit, do I
still need to close session? If I do, then how do I close session
without the warnings mentioned above?


Regards
Aapo <b/>ungle Laakkonen



-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
hibernate-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hibernate-devel

Reply via email to