Examples of UpdateBatchQuery


Examples of org.apache.cayenne.query.UpdateBatchQuery

        super(adapter);
    }

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

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

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

Examples of org.apache.cayenne.query.UpdateBatchQuery

        return values;
    }

    public String createSqlString(BatchQuery batch) {
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;
        String table = batch.getDbEntity().getFullyQualifiedName();
        List idDbAttributes = updateBatch.getQualifierAttributes();
        List updatedDbAttributes = updateBatch.getUpdatedAttributes();
        StringBuffer query = new StringBuffer("UPDATE ");
        query.append(table).append(" SET ");

        int len = updatedDbAttributes.size();
        for (int i = 0; i < len; i++) {
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

                    List batchKey = Arrays.asList(new Object[] {
                            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 replacementId = o.getObjectId().getReplacementIdMap();
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

                .getDbEntity();

        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);

        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
        UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
        String generatedSql = builder.createSqlString(updateQuery);
        assertNotNull(generatedSql);
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);

        DbAdapter adapter = objectFactory.newInstance(DbAdapter.class, JdbcAdapter.class.getName());
        UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
        String generatedSql = builder.createSqlString(updateQuery);
        assertNotNull(generatedSql);
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

            entity.getDataMap().setQuotingSQLIdentifiers(true);
            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);
            JdbcAdapter adapter = (JdbcAdapter) this.adapter;

            UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(updateQuery);
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);
            JdbcAdapter adapter = (JdbcAdapter) this.adapter;

            UpdateBatchQueryBuilder builder = new UpdateBatchQueryBuilder(adapter);
            String generatedSql = builder.createSqlString(updateQuery);
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();

        QuotingStrategy strategy = getAdapter().getQuotingStrategy();

        StringBuffer query = new StringBuffer("UPDATE ");
        query.append(strategy.quotedFullyQualifiedName(batch.getDbEntity()));
View Full Code Here

Examples of org.apache.cayenne.query.UpdateBatchQuery

        super(adapter);
    }

    @Override
    public String createSqlString(BatchQuery batch) throws IOException {
        UpdateBatchQuery updateBatch = (UpdateBatchQuery) batch;

        QuotingStrategy strategy = getAdapter().getQuotingStrategy();

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

        StringBuffer query = new StringBuffer("UPDATE ");
        query.append(strategy.quotedFullyQualifiedName(batch.getDbEntity()));
        query.append(" SET ");

        int len = updatedDbAttributes.size();
        for (int i = 0; i < len; i++) {
            if (i > 0) {
                query.append(", ");
            }

            DbAttribute attribute = updatedDbAttributes.get(i);
            query.append(strategy.quotedName(attribute));
            query.append(" = ?");
        }

        query.append(" WHERE ");

        Iterator<DbAttribute> i = qualifierAttributes.iterator();
        while (i.hasNext()) {
            DbAttribute attribute = i.next();
            appendDbAttribute(query, attribute);
            query.append(updateBatch.isNull(attribute) ? " IS NULL" : " = ?");

            if (i.hasNext()) {
                query.append(" AND ");
            }
        }
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.