Package org.apache.openjpa.meta

Examples of org.apache.openjpa.meta.ClassMetaData


    private Value getIdentifier(JPQLNode node) {
        final String name = node.text;
        final Value val = getVariable(name, false);

        ClassMetaData cmd = getMetaDataForAlias(name);

        if (cmd != null) {
            // handle the case where the class name is the alias
            // for the candidate (we don't use variables for this)
            Value thiz = factory.getThis();
View Full Code Here


        return path;
    }

    protected Class getDeclaredVariableType(String name) {
        ClassMetaData cmd = getMetaDataForAlias(name);
        if (cmd != null)
            return cmd.getDescribedType();

        if (name != null && name.equals(ctx().schemaAlias))
            return getCandidateType();

        // JPQL has no declared variables
View Full Code Here

                chain.addIterator(new FilterNewIterator());

            // add database iterators for each implementing class
            MetaDataRepository repos = _broker.getConfiguration().
                getMetaDataRepositoryInstance();
            ClassMetaData meta = repos.getMetaData(_type,
                _broker.getClassLoader(), false);

            ClassMetaData[] metas;
            if (meta != null && (!_subs || !meta.isManagedInterface())
                && (meta.isMapped() || (_subs
                && meta.getMappedPCSubclassMetaDatas().length > 0)))
                metas = new ClassMetaData[]{ meta };
            else if (_subs && (meta == null || meta.isManagedInterface()))
                metas = repos.getImplementorMetaDatas(_type,
                    _broker.getClassLoader(), false);
            else
                metas = EMPTY_METAS;
View Full Code Here

        for (Root<?> root : q.getRoots()) {
            metas.add(((AbstractManagedType<?>)root.getModel()).meta);
            for (Join<?,?> join : root.getJoins()) {
                Class<?> cls = join.getAttribute().getJavaType();
                if (join.getAttribute().isAssociation()) {
                    ClassMetaData meta = metamodel.getRepository().getMetaData(cls, null, true);
                    PersistenceType type = MetamodelImpl.getPersistenceType(meta);
                    if (type == PersistenceType.ENTITY || type == PersistenceType.EMBEDDABLE)
                        metas.add(meta);
                }
            }
View Full Code Here

        boolean contains(Class<?> cls) {
            if (_replicatedTypes.contains(cls))
                return true;
            if (_nonreplicatedTypes.contains(cls))
                return false;
            ClassMetaData meta = repos.getMetaData(cls, null, false);
            if (meta == null) {
                _nonreplicatedTypes.add(cls);
                return false;
            }
            boolean replicated = names.contains(meta.getDescribedType().getName());
            if (replicated) {
                _replicatedTypes.add(cls);
            } else {
                _nonreplicatedTypes.add(cls);
            }
View Full Code Here

        repo = emf.getConfiguration().getMetaDataRepositoryInstance();
    }

    public void testEmbeddedId() throws Exception {
        ClassMetaData cmd = repo.getMetaData(EmbeddedIdEntity.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new EmbeddedIdEntity());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected
View Full Code Here

        assertEquals(oid, JPAFacadeHelper.toOpenJPAObjectId(cmd, id));
    }

    public void testCompositeId() throws Exception {
        ClassMetaData cmd = repo.getMetaData(EntityWithCompositeId.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new EntityWithCompositeId());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected
View Full Code Here

        assertEquals(oid, JPAFacadeHelper.toOpenJPAObjectId(cmd, id));
    }

    public void testBasic() throws Exception {
        ClassMetaData cmd = repo.getMetaData(BasicEntity.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new BasicEntity());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected
View Full Code Here

        Object o = JPAFacadeHelper.toOpenJPAObjectId(cmd, entity.getId());
        assertEquals(o, JPAFacadeHelper.toOpenJPAObjectId(cmd, o));
    }

    public void testIntegerId() {
        ClassMetaData cmd = repo.getMetaData(Person.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new Person());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected
View Full Code Here

        assertEquals(oid, JPAFacadeHelper.toOpenJPAObjectId(cmd, id));
    }

    public void testDoubleId() {
        ClassMetaData cmd = repo.getMetaData(DoubleObjIdEntity.class, null, true);
        try {
            JPAFacadeHelper.toOpenJPAObjectId(cmd, new DoubleObjIdEntity());
            fail("Didn't fail!");
        } catch (UserException re) {
            // expected
View Full Code Here

TOP

Related Classes of org.apache.openjpa.meta.ClassMetaData

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.