Package se.unlogic.standardutils.dao.querys

Examples of se.unlogic.standardutils.dao.querys.UpdateQuery


    return this.delete(highLevelQuery, transactionHandler.getConnection());
  }

  public Integer delete(HighLevelQuery<T> highLevelQuery, Connection connection) throws SQLException {

    UpdateQuery query = null;

    try {
      query = new UpdateQuery(connection, false, this.deleteByFieldSQL + this.getCriterias(highLevelQuery, false));

      setQueryParameters(query, highLevelQuery, 1);

      query.executeUpdate();

      return query.getAffectedRows();

    } finally {

      PreparedStatementQuery.autoCloseQuery(query);
    }
View Full Code Here


        stringBuilder.append(" AND " + queryParameter.getColumn().getColumnName() + " " + queryParameter.getOperator() + " ?");
      }
    }

    UpdateQuery query = null;

    try {

      query = new UpdateQuery(connection, false, stringBuilder.toString());

      IntegerCounter integerCounter = new IntegerCounter();

      // Keys values from SimpleColumns for where not in statement
      this.setQueryValues(filteredBeans, query, integerCounter, this.simpleKeys, excludedField);

      // Keys values from many to one relations for where not in statement
      this.setQueryValues(filteredBeans, query, integerCounter, this.manyToOneRelationKeys.values(), excludedField);

      if (queryParameters != null) {

        // Set query param values
        this.setQueryParameters(query, new HighLevelQuery<T>(queryParameters), integerCounter.increment());
      }

      query.executeUpdate();

    } finally {
      PreparedStatementQuery.autoCloseQuery(query);
    }
View Full Code Here

  }
 
  public void executeScript(String script) throws SQLException {

    TransactionHandler transactionHandler = null;
    UpdateQuery updateQuery;

    ScriptUtility scriptUtility = new MySQLScriptUtility();
    List<String> statements = scriptUtility.getStatements(script);
   
    try {
     
      transactionHandler = new TransactionHandler(this.dataSource);

      for(String query : statements) {
        updateQuery = transactionHandler.getUpdateQuery(query.toString());
        updateQuery.executeUpdate();
      }
     
      transactionHandler.commit();

    } finally {
View Full Code Here

  public UpdateQuery getUpdateQuery(String sqlExpression) throws SQLException {

    this.checkStatus();

    UpdateQuery query = new UpdateQuery(connection, false, sqlExpression);

    checkQueryList();
   
    this.queryList.add(query);
View Full Code Here

TOP

Related Classes of se.unlogic.standardutils.dao.querys.UpdateQuery

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.