Examples of UpdateQuery


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

  public void add(T bean, Connection connection, RelationQuery relationQuery) throws SQLException {

    this.preAddRelations(bean, connection, relationQuery);

    UpdateQuery query = null;

    try {

      query = new UpdateQuery(connection, false, this.insertSQL);

      IntegerCounter integerCounter = new IntegerCounter();

      setQueryValues(bean, query, integerCounter, this.columnMap.values());
View Full Code Here

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

    this.update(bean, transactionHandler.getConnection(), relationQuery);
  }

  public Integer update(T bean, Connection connection, RelationQuery relationQuery) throws SQLException {

    UpdateQuery query = null;

    try {

      this.preUpdateRelations(bean, connection, relationQuery);

      query = new UpdateQuery(connection, false, this.updateSQL);

      IntegerCounter integerCounter = new IntegerCounter();

      // All fields
      this.setQueryValues(bean, query, integerCounter, this.columnMap.values());

      // Keys from SimpleColumns for where statement
      this.setQueryValues(bean, query, integerCounter, this.simpleKeys);

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

      query.executeUpdate();

    } finally {

      UpdateQuery.autoCloseQuery(query);
    }

    this.updateRelations(bean, connection, relationQuery);

    return query.getAffectedRows();
  }
View Full Code Here

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

    this.update(lowLevelQuery, transactionHandler.getConnection());
  }

  public void update(LowLevelQuery<T> lowLevelQuery, Connection connection) throws SQLException {

    UpdateQuery query = null;

    try {

      query = new UpdateQuery(connection, false, lowLevelQuery.getSql());

      this.setCustomQueryParameters(query, lowLevelQuery.getParameters());

      if (lowLevelQuery.getGeneratedKeyCollectors() != null) {

        query.executeUpdate(lowLevelQuery.getGeneratedKeyCollectors());

      } else {

        query.executeUpdate();
      }

    } finally {

      PreparedStatementQuery.autoCloseQuery(query);
View Full Code Here

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

    this.delete(bean, transactionHandler.getConnection());
  }

  public void delete(T bean, Connection connection) throws SQLException {

    UpdateQuery query = null;

    try {

      query = new UpdateQuery(connection, false, this.deleteSQL);

      IntegerCounter integerCounter = new IntegerCounter();

      // Keys from SimpleColumns for where statement
      this.setQueryValues(bean, query, integerCounter, this.simpleKeys);

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

      query.executeUpdate();

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

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

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

        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

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

  }
 
  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

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

  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
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.