Package com.github.jmkgreen.morphia.query

Examples of com.github.jmkgreen.morphia.query.ValidationException


                }

                Key<?> k = (value instanceof Key) ? (Key<?>) value : getKey(value);
                mappedValue = keyToRef(k);
                if (mappedValue == value) {
                    throw new ValidationException("cannot map to @Reference/Key<T>/DBRef field: " + value);
                }
                return mappedValue;
            } catch (Exception e) {
                log.error("Error converting value(" + value + ") to reference.", e);
                return toMongoObject(value, false);
View Full Code Here


                //translate from java field name to stored field name
                if (mf == null) {
                    mf = mc.getMappedFieldByJavaField(part);
                    if (mf == null)
                        throw new ValidationException("The field '" + part + "' could not be found in '" + clazz.getName() +
                                "' while validating - " + prop +
                                "; if you wish to continue please disable validation.");
                    hasTranslations = true;
                    parts[i] = mf.getNameToStore();
                }

                i++;
                if (mf.isMap()) {
                    //skip the map key validation, and move to the next part
                    i++;
                }

                //catch people trying to search/update into @Reference/@Serialized fields
                if (i < parts.length && !canQueryPast(mf))
                    throw new ValidationException("Can not use dot-notation past '" + part + "' could not be found in '" + clazz.getName() + "' while validating - " + prop);

                if (i >= parts.length) break;
                //get the next MappedClass for the next field validation
                mc = mapr.getMappedClass((mf.isSingleValue()) ? mf.getType() : mf.getSubClass());
            }
View Full Code Here

TOP

Related Classes of com.github.jmkgreen.morphia.query.ValidationException

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.