Examples of UpdateBatchQuery


Examples of org.apache.cayenne.query.UpdateBatchQuery

     * Binds BatchQuery parameters to the PreparedStatement.
     */
    @Override
    public void bindParameters(PreparedStatement statement, BatchQuery query) throws SQLException, Exception {

        UpdateBatchQuery updateBatch = (UpdateBatchQuery) query;
        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();

        int len = updatedDbAttributes.size();
        int parameterIndex = 1;
        for (int i = 0; i < len; i++) {
            Object value = query.getValue(i);

            DbAttribute attribute = updatedDbAttributes.get(i);
            adapter.bindParameter(statement, value, parameterIndex++, attribute.getType(), attribute.getScale());
        }

        for (int i = 0; i < qualifierAttributes.size(); i++) {
            Object value = query.getValue(len + i);
            DbAttribute attribute = qualifierAttributes.get(i);

            // skip null attributes... they are translated as "IS NULL"
            if (updateBatch.isNull(attribute)) {
                continue;
            }

            adapter.bindParameter(statement, value, parameterIndex++, attribute.getType(), attribute.getScale());
        }
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

                .getObjEntity(QuoteAdress.class)
                .getDbEntity();
        List idAttributes = Collections.singletonList(entity.getAttribute("City"));
        List updatedAttributes = Collections.singletonList(entity.getAttribute("City"));

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                null,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

                .lookupObjEntity(QuoteAdress.class)
                .getDbEntity();
        List idAttributes = Collections.singletonList(entity.getAttribute("City"));
        List updatedAttributes = Collections.singletonList(entity.getAttribute("City"));

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                null,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

    }

    @Override
    public List getValuesForLOBUpdateParameters(BatchQuery query) {
        int len = query.getDbAttributes().size();
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) query;

        List values = new ArrayList(len);
        List<DbAttribute> qualifierAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();

        int updatedLen = updatedDbAttributes.size();
        int qualifierLen = qualifierAttributes.size();
        for (int i = 0; i < updatedLen; i++) {
            DbAttribute attribute = updatedDbAttributes.get(i);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        return values;
    }

    @Override
    public String createSqlString(BatchQuery batch) {
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
        List<DbAttribute> idDbAttributes = updateBatch.getQualifierAttributes();
        List<DbAttribute> updatedDbAttributes = updateBatch.getUpdatedAttributes();
   
    boolean status;
        if (batch.getDbEntity().getDataMap() != null
                && batch.getDbEntity().getDataMap().isQuotingSQLIdentifiers()) {
            status = true;
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

                        }
                    }

                    List batchKey = Arrays.asList(snapshotSet, nullQualifierNames);

                    UpdateBatchQuery batch = (UpdateBatchQuery) batches.get(batchKey);
                    if (batch == null) {
                        batch = new UpdateBatchQuery(
                                dbEntity,
                                qualifierBuilder.getAttributes(),
                                updatedAttributes(dbEntity, snapshot),
                                nullQualifierNames,
                                10);

                        batch.setUsingOptimisticLocking(qualifierBuilder
                                .isUsingOptimisticLocking());
                        batches.put(batchKey, batch);
                    }

                    batch.add(qualifierSnapshot, snapshot, o.getObjectId());

                    // update replacement id with meaningful PK changes
                    if (isRootDbEntity) {
                        Map<String, Object> replacementId = o
                                .getObjectId()
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        List idAttributes = Collections.singletonList(entity
                .getAttribute("LOCKING_TEST_ID"));
        List updatedAttributes = Collections.singletonList(entity
                .getAttribute("DESCRIPTION"));

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                null,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        List updatedAttributes = Collections.singletonList(entity
                .getAttribute("DESCRIPTION"));

        Collection nullAttributes = Collections.singleton("NAME");

        UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                entity,
                idAttributes,
                updatedAttributes,
                nullAttributes,
                1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

            List idAttributes = Collections.singletonList(entity
                    .getAttribute("LOCKING_TEST_ID"));
            List updatedAttributes = Collections.singletonList(entity
                    .getAttribute("DESCRIPTION"));

            UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                    entity,
                    idAttributes,
                    updatedAttributes,
                    null,
                    1);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

            List updatedAttributes = Collections.singletonList(entity
                    .getAttribute("DESCRIPTION"));

            Collection nullAttributes = Collections.singleton("NAME");

            UpdateBatchQuery updateQuery = new UpdateBatchQuery(
                    entity,
                    idAttributes,
                    updatedAttributes,
                    nullAttributes,
                    1);
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.