User: schulze 
  Date: 00/10/11 16:23:58

  Modified:    src/main/org/jboss/ejb/plugins/jaws/jdbc
                        JDBCInitCommand.java JDBCDestroyCommand.java
  Log:
  moved the transaction code from the persistence manager into the init/destroy 
commands.
  This enables us to move back to the previous table finder code
  (if the MetaData version doesnt work as expected for any reason).
  
  Revision  Changes    Path
  1.8       +12 -1     
jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCInitCommand.java
  
  Index: JDBCInitCommand.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCInitCommand.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JDBCInitCommand.java      2000/10/11 19:40:41     1.7
  +++ JDBCInitCommand.java      2000/10/11 23:23:57     1.8
  @@ -28,7 +28,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Joe Shevland</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Justin Forder</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class JDBCInitCommand
      extends JDBCUpdateCommand
  @@ -100,11 +100,22 @@
            } else {
                try
                {
  +                 // since we use the pools, we have to do this within a transaction
  +                factory.getContainer().getTransactionManager().begin ();
                   jdbcExecute(null);
  +                factory.getContainer().getTransactionManager().commit ();
                } catch (Exception e)
                {
                   log.debug("Could not create table " +
                             jawsEntity.getTableName() + ": " + e.getMessage());
  +                try
  +                {
  +                   factory.getContainer().getTransactionManager().rollback ();
  +                }
  +                catch (Exception _e)
  +                {
  +                   log.error("Could not roll back transaction: "+ _e.getMessage());
  +                }
                }
            }
         }
  
  
  
  1.5       +13 -1     
jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCDestroyCommand.java
  
  Index: JDBCDestroyCommand.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/ejb/plugins/jaws/jdbc/JDBCDestroyCommand.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JDBCDestroyCommand.java   2000/09/09 02:52:56     1.4
  +++ JDBCDestroyCommand.java   2000/10/11 23:23:58     1.5
  @@ -20,7 +20,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Joe Shevland</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Justin Forder</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class JDBCDestroyCommand
      extends JDBCUpdateCommand
  @@ -46,11 +46,23 @@
            // Remove it!
            try
            {
  +            // since we use the pools, we have to do this within a transaction
  +            factory.getContainer().getTransactionManager().begin ();
               jdbcExecute(null);
  +            factory.getContainer().getTransactionManager().commit ();
            } catch (Exception e)
            {
               log.debug("Could not drop table " +
                         jawsEntity.getTableName() + ": " + e.getMessage());
  +
  +            try
  +            {
  +               factory.getContainer().getTransactionManager().rollback ();
  +            }
  +            catch (Exception _e)
  +            {
  +               log.error("Could not roll back transaction: "+ _e.getMessage());
  +            }
            }
         }
      }
  
  
  

Reply via email to