beehive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Schoettger" <cscho...@bea.com>
Subject RE: Problem using transactions with JDBC control
Date Thu, 12 May 2005 19:03:20 GMT
Hi Scott,

The drts for the jdbcontrol include a few unit tests for transactions --
they are not currently failing.

Other than the move from controlhaus to beehive nothing has changed in
the jdbccontrol code.


In the code sample below why is the connection.commit() call commented
out?  Does it work for you if it is uncommented?  


  - Chad


-----Original Message-----
From: Scott Semyan 
Sent: Thursday, May 12, 2005 11:46 AM
To: Beehive Developers
Subject: Problem using transactions with JDBC control

I have a new error in the PetStore web sample. I have a section of code
that uses a transaction to add something to the database. I initially
enabled this with the following code:
 
 public int addOrder(Order order, Cart cart)
 {
  try {
   java.sql.Connection connection = _dbControl.getConnection();
   connection.setAutoCommit( false );
   
   // Add order to DB
   // Add the cart items and update the quantities in the DB
   //connection.commit();

  } catch (SQLException e) {

            _logger.error( "Unexpected DAO exception", e );
   throw new DataStoreException("unexpected database exception");

  }

  return orderId;
}

 
This used to work fine. Now when I do it, the order is added correctly,
but the subsequent call to the database (to read the contents of the
order just entered) generates the following:
 
Exception: org.apache.beehive.controls.api.ControlException: SQL
Exception while attempting to close database connection.[Invalid
transaction state.]
caused by : SQL Exception: Invalid transaction state. 
 
 
Did anything change recently? Is this the proper way to do transactions
with the JDBC control?
 
Scott Semyan


Mime
View raw message