Package org.hibernate.engine.transaction

Examples of org.hibernate.engine.transaction.IsolatedWork


  }

  protected void createTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    // Don't really know all the codes required to adequately decipher returned jdbc exceptions here.
    // simply allow the failure to be eaten and the subsequent insert-selects/deletes should fail
    IsolatedWork work = new IsolatedWork() {
      public void doWork(Connection connection) throws HibernateException {
        Statement stmnt = null;
        try {
          stmnt = connection.createStatement();
          stmnt.executeUpdate( persister.getTemporaryIdTableDDL() );
        }
        catch( Throwable t ) {
          log.debug( "unable to create temporary id table [" + t.getMessage() + "]" );
        }
        finally {
          if ( stmnt != null ) {
            try {
              stmnt.close();
            }
            catch( Throwable ignore ) {
              // ignore
            }
          }
        }
      }
    };
    if ( shouldIsolateTemporaryTableDDL() ) {
      if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
        Isolater.doIsolatedWork( work, session );
      }
      else {
        Isolater.doNonTransactedWork( work, session );
      }
    }
    else {
      work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
      session.getJDBCContext().getConnectionManager().afterStatement();
    }
  }
View Full Code Here


    }
  }

  protected void dropTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    if ( getFactory().getDialect().dropTemporaryTableAfterUse() ) {
      IsolatedWork work = new IsolatedWork() {
        public void doWork(Connection connection) throws HibernateException {
          Statement stmnt = null;
          try {
            stmnt = connection.createStatement();
            stmnt.executeUpdate( "drop table " + persister.getTemporaryIdTableName() );
          }
          catch( Throwable t ) {
            log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );
          }
          finally {
            if ( stmnt != null ) {
              try {
                stmnt.close();
              }
              catch( Throwable ignore ) {
                // ignore
              }
            }
          }
        }
      };

      if ( shouldIsolateTemporaryTableDDL() ) {
        if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
          Isolater.doIsolatedWork( work, session );
        }
        else {
          Isolater.doNonTransactedWork( work, session );
        }
      }
      else {
        work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
        session.getJDBCContext().getConnectionManager().afterStatement();
      }
    }
    else {
      // at the very least cleanup the data :)
View Full Code Here

  }

  protected void createTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    // Don't really know all the codes required to adequately decipher returned jdbc exceptions here.
    // simply allow the failure to be eaten and the subsequent insert-selects/deletes should fail
    IsolatedWork work = new IsolatedWork() {
      public void doWork(Connection connection) throws HibernateException {
        Statement stmnt = null;
        try {
          stmnt = connection.createStatement();
          stmnt.executeUpdate( persister.getTemporaryIdTableDDL() );
        }
        catch( Throwable t ) {
          log.debug( "unable to create temporary id table [" + t.getMessage() + "]" );
        }
        finally {
          if ( stmnt != null ) {
            try {
              stmnt.close();
            }
            catch( Throwable ignore ) {
              // ignore
            }
          }
        }
      }
    };
    if ( shouldIsolateTemporaryTableDDL() ) {
      if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
        Isolater.doIsolatedWork( work, session );
      }
      else {
        Isolater.doNonTransactedWork( work, session );
      }
    }
    else {
      work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
      session.getJDBCContext().getConnectionManager().afterStatement();
    }
  }
View Full Code Here

    }
  }

  protected void dropTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    if ( getFactory().getDialect().dropTemporaryTableAfterUse() ) {
      IsolatedWork work = new IsolatedWork() {
        public void doWork(Connection connection) throws HibernateException {
          Statement stmnt = null;
          try {
            final String command = session.getFactory()
                .getSettings().getDialect()
                .getDropTemporaryTableString()
                + " " + persister.getTemporaryIdTableName();
            stmnt = connection.createStatement();
            stmnt.executeUpdate(command);
          }
          catch( Throwable t ) {
            log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );
          }
          finally {
            if ( stmnt != null ) {
              try {
                stmnt.close();
              }
              catch( Throwable ignore ) {
                // ignore
              }
            }
          }
        }
      };

      if ( shouldIsolateTemporaryTableDDL() ) {
        if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
          Isolater.doIsolatedWork( work, session );
        }
        else {
          Isolater.doNonTransactedWork( work, session );
        }
      }
      else {
        work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
        session.getJDBCContext().getConnectionManager().afterStatement();
      }
    }
    else {
      // at the very least cleanup the data :)
View Full Code Here

  }

  protected void createTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    // Don't really know all the codes required to adequately decipher returned jdbc exceptions here.
    // simply allow the failure to be eaten and the subsequent insert-selects/deletes should fail
    IsolatedWork work = new IsolatedWork() {
      public void doWork(Connection connection) throws HibernateException {
        Statement stmnt = null;
        try {
          stmnt = connection.createStatement();
          stmnt.executeUpdate( persister.getTemporaryIdTableDDL() );
        }
        catch( Throwable t ) {
          log.debug( "unable to create temporary id table [" + t.getMessage() + "]" );
        }
        finally {
          if ( stmnt != null ) {
            try {
              stmnt.close();
            }
            catch( Throwable ignore ) {
              // ignore
            }
          }
        }
      }
    };
    if ( shouldIsolateTemporaryTableDDL() ) {
      if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
        Isolater.doIsolatedWork( work, session );
      }
      else {
        Isolater.doNonTransactedWork( work, session );
      }
    }
    else {
      work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
      session.getJDBCContext().getConnectionManager().afterStatement();
    }
  }
View Full Code Here

    }
  }

  protected void dropTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    if ( getFactory().getDialect().dropTemporaryTableAfterUse() ) {
      IsolatedWork work = new IsolatedWork() {
        public void doWork(Connection connection) throws HibernateException {
          Statement stmnt = null;
          try {
            final String command = session.getFactory().getSettings().getDialect().getDropTemporaryTableString()
                + " " + persister.getTemporaryIdTableName();
            stmnt = connection.createStatement();
            stmnt.executeUpdate( command );
          }
          catch( Throwable t ) {
            log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );
          }
          finally {
            if ( stmnt != null ) {
              try {
                stmnt.close();
              }
              catch( Throwable ignore ) {
                // ignore
              }
            }
          }
        }
      };

      if ( shouldIsolateTemporaryTableDDL() ) {
        if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
          Isolater.doIsolatedWork( work, session );
        }
        else {
          Isolater.doNonTransactedWork( work, session );
        }
      }
      else {
        work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
        session.getJDBCContext().getConnectionManager().afterStatement();
      }
    }
    else {
      // at the very least cleanup the data :)
View Full Code Here

  }

  protected void createTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    // Don't really know all the codes required to adequately decipher returned jdbc exceptions here.
    // simply allow the failure to be eaten and the subsequent insert-selects/deletes should fail
    IsolatedWork work = new IsolatedWork() {
      public void doWork(Connection connection) throws HibernateException {
        Statement stmnt = null;
        try {
          stmnt = connection.createStatement();
          stmnt.executeUpdate( persister.getTemporaryIdTableDDL() );
        }
        catch( Throwable t ) {
          log.debug( "unable to create temporary id table [" + t.getMessage() + "]" );
        }
        finally {
          if ( stmnt != null ) {
            try {
              stmnt.close();
            }
            catch( Throwable ignore ) {
              // ignore
            }
          }
        }
      }
    };
    if ( shouldIsolateTemporaryTableDDL() ) {
      if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
        Isolater.doIsolatedWork( work, session );
      }
      else {
        Isolater.doNonTransactedWork( work, session );
      }
    }
    else {
      work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
      session.getJDBCContext().getConnectionManager().afterStatement();
    }
  }
View Full Code Here

    }
  }

  protected void dropTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    if ( getFactory().getDialect().dropTemporaryTableAfterUse() ) {
      IsolatedWork work = new IsolatedWork() {
        public void doWork(Connection connection) throws HibernateException {
          Statement stmnt = null;
          try {
            final String command = session.getFactory()
                .getSettings().getDialect()
                .getDropTemporaryTableString()
                + " " + persister.getTemporaryIdTableName();
            stmnt = connection.createStatement();
            stmnt.executeUpdate(command);
          }
          catch( Throwable t ) {
            log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );
          }
          finally {
            if ( stmnt != null ) {
              try {
                stmnt.close();
              }
              catch( Throwable ignore ) {
                // ignore
              }
            }
          }
        }
      };

      if ( shouldIsolateTemporaryTableDDL() ) {
        if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
          Isolater.doIsolatedWork( work, session );
        }
        else {
          Isolater.doNonTransactedWork( work, session );
        }
      }
      else {
        work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
        session.getJDBCContext().getConnectionManager().afterStatement();
      }
    }
    else {
      // at the very least cleanup the data :)
View Full Code Here

  }

  protected void createTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    // Don't really know all the codes required to adequately decipher returned jdbc exceptions here.
    // simply allow the failure to be eaten and the subsequent insert-selects/deletes should fail
    IsolatedWork work = new IsolatedWork() {
      public void doWork(Connection connection) throws HibernateException {
        Statement stmnt = null;
        try {
          stmnt = connection.createStatement();
          stmnt.executeUpdate( persister.getTemporaryIdTableDDL() );
        }
        catch( Throwable t ) {
          log.debug( "unable to create temporary id table [" + t.getMessage() + "]" );
        }
        finally {
          if ( stmnt != null ) {
            try {
              stmnt.close();
            }
            catch( Throwable ignore ) {
              // ignore
            }
          }
        }
      }
    };
    if ( shouldIsolateTemporaryTableDDL() ) {
      if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
        Isolater.doIsolatedWork( work, session );
      }
      else {
        Isolater.doNonTransactedWork( work, session );
      }
    }
    else {
      work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
      session.getJDBCContext().getConnectionManager().afterStatement();
    }
  }
View Full Code Here

    }
  }

  protected void dropTemporaryTableIfNecessary(final Queryable persister, final SessionImplementor session) {
    if ( getFactory().getDialect().dropTemporaryTableAfterUse() ) {
      IsolatedWork work = new IsolatedWork() {
        public void doWork(Connection connection) throws HibernateException {
          Statement stmnt = null;
          try {
            stmnt = connection.createStatement();
            stmnt.executeUpdate( "drop table " + persister.getTemporaryIdTableName() );
          }
          catch( Throwable t ) {
            log.warn( "unable to drop temporary id table after use [" + t.getMessage() + "]" );
          }
          finally {
            if ( stmnt != null ) {
              try {
                stmnt.close();
              }
              catch( Throwable ignore ) {
                // ignore
              }
            }
          }
        }
      };

      if ( shouldIsolateTemporaryTableDDL() ) {
        if ( getFactory().getSettings().isDataDefinitionInTransactionSupported() ) {
          Isolater.doIsolatedWork( work, session );
        }
        else {
          Isolater.doNonTransactedWork( work, session );
        }
      }
      else {
        work.doWork( session.getJDBCContext().getConnectionManager().getConnection() );
        session.getJDBCContext().getConnectionManager().afterStatement();
      }
    }
    else {
      // at the very least cleanup the data :)
View Full Code Here

TOP

Related Classes of org.hibernate.engine.transaction.IsolatedWork

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.