Package org.hibernate.engine.jdbc.spi

Examples of org.hibernate.engine.jdbc.spi.SqlStatementLogger.logStatement()


                    .getService( JdbcServices.class )
                    .getSqlStatementLogger();
                IntegralDataTypeHolder value = IdentifierGeneratorHelper.getIntegralDataTypeHolder( numberType );
                int rows;
                do {
                  statementLogger.logStatement( selectQuery, FormatStyle.BASIC.getFormatter() );
                  PreparedStatement selectStatement = connection.prepareStatement( selectQuery );
                  try {
                    ResultSet selectRS = selectStatement.executeQuery();
                    if ( !selectRS.next() ) {
                      String err = "could not read a hi value - you need to populate the table: " + tableName;
View Full Code Here


                  }
                  finally {
                    selectStatement.close();
                  }

                  statementLogger.logStatement( updateQuery, FormatStyle.BASIC.getFormatter() );
                  PreparedStatement updatePS = connection.prepareStatement( updateQuery );
                  try {
                    final int increment = applyIncrementSizeToSourceValues ? incrementSize : 1;
                    final IntegralDataTypeHolder updateValue = value.copy().add( increment );
                    updateValue.bind( updatePS, 1 );
View Full Code Here

            do {
              // The loop ensures atomicity of the
              // select + update even for no transaction
              // or read committed isolation level

              statementLogger.logStatement( query, FormatStyle.BASIC.getFormatter() );
              PreparedStatement qps = connection.prepareStatement( query );
              try {
                ResultSet rs = qps.executeQuery();
                if ( !rs.next() ) {
                  String err = "could not read a hi value - you need to populate the table: " + tableName;
View Full Code Here

              }
              finally {
                qps.close();
              }

              statementLogger.logStatement( update, FormatStyle.BASIC.getFormatter() );
              PreparedStatement ups = connection.prepareStatement(update);
              try {
                value.copy().increment().bind( ups, 1 );
                value.bind( ups, 2 );
                rows = ups.executeUpdate();
View Full Code Here

                  @Override
                  public IntegralDataTypeHolder execute(Connection connection) throws SQLException {
                    IntegralDataTypeHolder value = IdentifierGeneratorHelper.getIntegralDataTypeHolder( identifierType.getReturnedClass() );
                    int rows;
                    do {
                      statementLogger.logStatement( selectQuery, FormatStyle.BASIC.getFormatter() );
                      PreparedStatement selectPS = connection.prepareStatement( selectQuery );
                      try {
                        selectPS.setString( 1, segmentValue );
                        ResultSet selectRS = selectPS.executeQuery();
                        if ( !selectRS.next() ) {
View Full Code Here

                        ResultSet selectRS = selectPS.executeQuery();
                        if ( !selectRS.next() ) {
                          value.initialize( initialValue );
                          PreparedStatement insertPS = null;
                          try {
                            statementLogger.logStatement( insertQuery, FormatStyle.BASIC.getFormatter() );
                            insertPS = connection.prepareStatement( insertQuery );
                            insertPS.setString( 1, segmentValue );
                            value.bind( insertPS, 2 );
                            insertPS.execute();
                          }
View Full Code Here

                      }
                      finally {
                        selectPS.close();
                      }

                      statementLogger.logStatement( updateQuery, FormatStyle.BASIC.getFormatter() );
                      PreparedStatement updatePS = connection.prepareStatement( updateQuery );
                      try {
                        final IntegralDataTypeHolder updateValue = value.copy();
                        if ( optimizer.applyIncrementSizeToSourceValues() ) {
                          updateValue.add( incrementSize );
View Full Code Here

            .getServiceRegistry()
            .getService( JdbcServices.class )
            .getSqlStatementLogger();
        int rows;
        do {
          statementLogger.logStatement( query, FormatStyle.BASIC.getFormatter() );
          PreparedStatement qps = connection.prepareStatement( query );
          PreparedStatement ips = null;
          try {
            ResultSet rs = qps.executeQuery();
            boolean isInitialized = rs.next();
View Full Code Here

          try {
            ResultSet rs = qps.executeQuery();
            boolean isInitialized = rs.next();
            if ( !isInitialized ) {
              value.initialize( 0 );
              statementLogger.logStatement( insert, FormatStyle.BASIC.getFormatter() );
              ips = connection.prepareStatement( insert );
              value.bind( ips, 1 );
              ips.execute();
            }
            else {
View Full Code Here

              ips.close();
            }
            qps.close();
          }

          statementLogger.logStatement( update, FormatStyle.BASIC.getFormatter() );
          PreparedStatement ups = connection.prepareStatement( update );
          try {
            value.copy().increment().bind( ups, 1 );
            value.bind( ups, 2 );
            rows = ups.executeUpdate();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.