Package org.apache.openjpa.util

Examples of org.apache.openjpa.util.MetaDataException


                if (_sysSeq == null)
                    _sysSeq = newSequenceMetaData(name);
                return _sysSeq;
            }
            if (meta == null && mustExist)
                throw new MetaDataException(_loc.get("no-named-sequence", name));
            return meta;
    }
View Full Code Here


     * Used internally by metadata to retrieve sequence metadatas based on possibly-unqualified
     * sequence name.
     */
    SequenceMetaData getSequenceMetaData(ClassMetaData context, String name, boolean mustExist) {
        // try with given name
        MetaDataException e = null;
        try {
            SequenceMetaData seq = getSequenceMetaData(name, context.getEnvClassLoader(), mustExist);
            if (seq != null)
                return seq;
        } catch (MetaDataException mde) {
View Full Code Here

            // use this instead of getting meta from element b/c that
            // requires element to be resolved
            ClassMetaData meta = getRepository().getMetaData
                (_owner.getElement().getType(), null, false);
            if (meta == null)
                throw new MetaDataException(_loc.get("val-not-pc", _owner));
            if (meta.getPrimaryKeyFields().length != 1)
                throw new MetaDataException(_loc.get("val-not-one-pk",
                    _owner));
            _mappedByMeta = meta.getPrimaryKeyFields()[0];
            _mappedBy = _mappedByMeta.getName();
        }
        return _mappedBy;
View Full Code Here

        if (getValueMappedBy() != null && _mappedByMeta == null) {
            ClassMetaData meta = _owner.getElement().getTypeMetaData();
            FieldMetaData field = (meta == null) ? null
                : meta.getField(getValueMappedBy());
            if (field == null)
                throw new MetaDataException(_loc.get("no-mapped-by", this,
                    getValueMappedBy()));
            if (field.getMappedBy() != null)
                throw new MetaDataException(_loc.get("circ-mapped-by", this,
                    getValueMappedBy()));
            _mappedByMeta = field;
        }
        return _mappedByMeta;
    }
View Full Code Here

            }
        }

        Set<String> classes = getPersistentTypeNames(false, multi);
        if (classes == null || classes.size() == 0) {
            throw new MetaDataException(_loc.get("repos-initializeEager-none"));
        }
        if (_log.isTraceEnabled() == true) {
            _log.trace(_loc.get("repos-initializeEager-found", classes));
        }

        List<Class<?>> loaded = new ArrayList<Class<?>>();
        for (String c : classes) {
            try {
                Class<?> cls = AccessController.doPrivileged((J2DoPrivHelper.getForNameAction(c, true, multi)));
                loaded.add(cls);
                // This call may be unnecessary?
                _factory.load(cls, MODE_ALL, multi);
            } catch (PrivilegedActionException pae) {
                throw new MetaDataException(_loc.get("repos-initializeEager-error"), pae);
            }
        }
        resolveAll(multi);
       
        // Preload XML MetaData
View Full Code Here

                cls = _implGen.toManagedInterface(cls);
            meta = getMetaDataInternal(cls, envLoader);
        }
        if (meta == null && mustExist) {
            if (cls != null && !ImplHelper.isManagedType(_conf, cls))
                throw new MetaDataException(_loc.get("no-meta-notpc", cls)).setFatal(false);

            Set<String> pcNames = getPersistentTypeNames(false, envLoader);
            if (pcNames != null && pcNames.size() > 0)
                throw new MetaDataException(_loc.get("no-meta-types", cls, pcNames));

            throw new MetaDataException(_loc.get("no-meta", cls));
        }
        resolve(meta);
        return meta;
    }
View Full Code Here

     *            if true, throws a {@link MetaDataException} if no metadata is found
     * @see ClassMetaData#getTypeAlias
     */
    public ClassMetaData getMetaData(String alias, ClassLoader envLoader, boolean mustExist) {
        if (alias == null && mustExist)
            throw new MetaDataException(_loc.get("no-alias-meta", alias, _aliases));
        if (alias == null)
            return null;

        // check cache
        processRegisteredClasses(envLoader);
View Full Code Here

    }

    private ClassMetaData throwNoRegisteredAlias(String alias) {
        String close = getClosestAliasName(alias);
        if (close != null)
            throw new MetaDataException(_loc.get("no-alias-meta-hint", alias, _aliases, close));
        else
            throw new MetaDataException(_loc.get("no-alias-meta", alias, _aliases));
    }
View Full Code Here

                case JavaTypes.PC:
                case JavaTypes.PC_UNTYPED:
                    if (Serializable.class.isAssignableFrom(type))
                        fmd.setSerialized(true);
                    else
                        throw new MetaDataException(_loc.get("bad-meta-anno",
                            fmd, "Basic"));
                    break;
                case JavaTypes.ARRAY:
                    if (type == char[].class || type == Character[].class
                        || type == byte[].class || type == Byte[].class)
                        break;
                    if (Serializable.class.isAssignableFrom
                        (type.getComponentType()))
                        fmd.setSerialized(true);
                    else
                        throw new MetaDataException(_loc.get("bad-meta-anno",
                            fmd, "Basic"));
                    break;
            }
        }
View Full Code Here

    /**
     * Parse @ManyToOne.
     */
    private void parseManyToOne(FieldMetaData fmd, ManyToOne anno) {
        if (!JavaTypes.maybePC(fmd.getValue()))
            throw new MetaDataException(_loc.get("bad-meta-anno", fmd,
                "ManyToOne"));

        // don't specifically exclude relation from DFG b/c that will prevent
        // us from even reading the fk when reading from the primary table,
        // which is not what most users will want
View Full Code Here

TOP

Related Classes of org.apache.openjpa.util.MetaDataException

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.