Package org.apache.cayenne.query

Examples of org.apache.cayenne.query.BatchQuery


            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here


            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        for (DbAttribute attribute : batch.getDbEntity().getGeneratedAttributes()) {

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
            if (attribute.isPrimaryKey()) {
                Object value = key.values().iterator().next();
View Full Code Here

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = (DataRow) keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        Iterator it = batch.getDbEntity().getGeneratedAttributes().iterator();
        while (it.hasNext()) {
            DbAttribute attribute = (DbAttribute) it.next();

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
View Full Code Here

            int rangeStart = 0;
            int len = queries.size();

            for (int i = 0; i < len; i++) {

                BatchQuery query = (BatchQuery) queries.get(i);
                if (query.getDbEntity() != lastEntity) {
                    lastEntity = query.getDbEntity();

                    DataNode node = domain.lookupDataNode(lastEntity.getDataMap());
                    if (node != lastNode) {

                        if (i - rangeStart > 0) {
View Full Code Here

            throw new CayenneRuntimeException(
                    "Generated keys only supported for InsertBatchQuery, instead got "
                            + query);
        }

        BatchQuery batch = (BatchQuery) query;

        ObjectId id = batch.getObjectId();
        if (id == null || !id.isTemporary()) {
            // why would this happen?
            return;
        }

        if (keys.size() != 1) {
            throw new CayenneRuntimeException(
                    "One and only one PK row is expected, instead got " + keys.size());
        }

        DataRow key = (DataRow) keys.get(0);

        // empty key?
        if (key.size() == 0) {
            throw new CayenneRuntimeException("Empty key generated.");
        }

        // determine DbAttribute name...

        // As of now (01/2005) all tested drivers don't provide decent descriptors of
        // identity result sets, so a data row will contain garbage labels. Also most
        // DBs only support one autogenerated key per table... So here we will have to
        // infer the key name and currently will only support a single column...
        if (key.size() > 1) {
            throw new CayenneRuntimeException(
                    "Only a single column autogenerated PK is supported. "
                            + "Generated key: "
                            + key);
        }

        Iterator it = batch.getDbEntity().getGeneratedAttributes().iterator();
        while (it.hasNext()) {
            DbAttribute attribute = (DbAttribute) it.next();

            // batch can have generated attributes that are not PKs, e.g. columns with
            // DB DEFAULT values. Ignore those.
View Full Code Here

TOP

Related Classes of org.apache.cayenne.query.BatchQuery

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.