Package org.jooq.exception

Examples of org.jooq.exception.InvalidResultException


        if (r.size() == 1) {
            return r.get(0);
        }
        else if (r.size() > 1) {
            throw new InvalidResultException("Query returned more than one result");
        }

        return null;
    }
View Full Code Here


    public final <K> Map<K, R> fetchMap(Field<K> key) {
        Map<K, R> map = new LinkedHashMap<K, R>();

        for (R record : fetch()) {
            if (map.put(record.getValue(key), record) != null) {
                throw new InvalidResultException("Key " + key + " is not unique in Result for " + this);
            }
        }

        return map;
    }
View Full Code Here

    private final Map<String, Object> convertToMap(R record) {
        Map<String, Object> map = new LinkedHashMap<String, Object>();

        for (Field<?> field : record.getFields()) {
            if (map.put(field.getName(), record.getValue(field)) != null) {
                throw new InvalidResultException("Field " + field.getName() + " is not unique in Record for " + this);
            }
        }

        return map;
    }
View Full Code Here

    private static int filterOne(int i, String action) {
        if (i <= 1) {
            return i;
        }
        else {
            throw new InvalidResultException("Too many rows " + action + " : " + i);
        }
    }
View Full Code Here

            for (Field<?> field : getFields()) {
                setValue0(field, record.getValue0(field));
            }
        }
        else {
            throw new InvalidResultException("Exactly one row expected for refresh. Record does not exist in database.");
        }
    }
View Full Code Here

        int size = fields.size();
        for (int i = 0; i < size; i++) {
            Field<?> field = fields.field(i);

            if (map.put(field.getName(), getValue(i)) != null) {
                throw new InvalidResultException("Field " + field.getName() + " is not unique in Record : " + this);
            }
        }

        return map;
    }
View Full Code Here

                        return record;
                    }
                });
        }
        else {
            throw new InvalidResultException("Exactly one row expected for refresh. Record does not exist in database.");
        }
    }
View Full Code Here

        int index = indexOrFail(fieldsRow(), key);
        Map<K, R> map = new LinkedHashMap<K, R>();

        for (R record : this) {
            if (map.put((K) record.getValue(index), record) != null) {
                throw new InvalidResultException("Key " + key + " is not unique in Result for " + this);
            }
        }

        return map;
    }
View Full Code Here

        Map<K, V> map = new LinkedHashMap<K, V>();

        for (R record : this) {
            if (map.put((K) record.getValue(kIndex), (V) record.getValue(vIndex)) != null) {
                throw new InvalidResultException("Key " + key + " is not unique in Result for " + this);
            }
        }

        return map;
    }
View Full Code Here

            for (Field<?> field : keys) {
                Utils.copyValue(key, field, record, field);
            }

            if (map.put(key, record) != null) {
                throw new InvalidResultException("Key list " + Arrays.asList(keys) + " is not unique in Result for " + this);
            }
        }

        return map;
    }
View Full Code Here

TOP

Related Classes of org.jooq.exception.InvalidResultException

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.