Examples of JpaEntityMap


Examples of org.apache.cayenne.jpa.map.JpaEntityMap

    }

    public void testDataMapDefaults() {
        EntityMapLoaderContext context = new EntityMapLoaderContext(
                new MockPersistenceUnitInfo());
        JpaEntityMap jpaMap = context.getEntityMap();
        jpaMap.setPackageName("p1");
        jpaMap.setSchema("s1");

        // TODO: unsupported by DataMap
        // jpaMap.setCatalog("c1");

        DataMap cayenneMap = new DataMapConverter().toDataMap("n1", context);
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

        EntityMapLoaderContext context = new EntityMapLoaderContext(
                new MockPersistenceUnitInfo());
        EntityMapAnnotationLoader loader = new EntityMapAnnotationLoader(context);
        loader.loadClassMapping(MockAnnotatedBeanOrdering.class);

        JpaEntityMap map = context.getEntityMap();
        JpaEntity entity = map.getEntities().iterator().next();

        // regardless of the ordering of annotations, we should get the same result for
        // both attributes
        assertEquals(3, entity.getAttributes().getBasicAttributes().size());
        JpaBasic a1 = entity.getAttributes().getBasicAttribute("attribute1");
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

        EntityMapLoaderContext context = new EntityMapLoaderContext(
                new MockPersistenceUnitInfo());
        EntityMapAnnotationLoader loader = new EntityMapAnnotationLoader(context);
        loader.loadClassMapping(MockAnnotatedBean2.class);

        JpaEntityMap map = context.getEntityMap();
        assertEquals(1, map.getEntities().size());
        JpaEntity entity = map.getEntities().iterator().next();
        assertEquals(1, entity.getAttributeOverrides().size());
        JpaAttributeOverride entityOverride = entity
                .getAttributeOverrides()
                .iterator()
                .next();
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

        loader.loadClassMapping(MockAnnotatedBean5.class);

        // apply defaults
        EntityMapDefaultsProcessor defaultsProcessor = new EntityMapDefaultsProcessor();
        defaultsProcessor.applyDefaults(context);
        JpaEntityMap map = context.getEntityMap();
        entity = map.entityForClass(MockAnnotatedBean3.class);
        assertNotNull(entity);
    }
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

            JpaManagedClass entity = path.firstInstanceOf(JpaManagedClass.class);
            access = entity.getAccess();

            if (access == null) {
                JpaEntityMap map = path.firstInstanceOf(JpaEntityMap.class);
                access = map.getAccess();
            }

            Class<?> objectClass = targetPath
                    .firstInstanceOf(Embeddable.class)
                    .getJavaClass();
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

            JpaManagedClass entity = path.firstInstanceOf(JpaManagedClass.class);
            access = entity.getAccess();

            if (access == null) {
                JpaEntityMap map = path.firstInstanceOf(JpaEntityMap.class);
                access = map.getAccess();
            }

            Class<?> objectClass = targetPath
                    .firstInstanceOf(ObjEntity.class)
                    .getJavaClass();
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

        loadedLocations.add(DESCRIPTOR_LOCATION);
        Enumeration<URL> standardDescriptors = context.getTempClassLoader().getResources(
                DESCRIPTOR_LOCATION);

        while (standardDescriptors.hasMoreElements()) {
            JpaEntityMap map = loader.getEntityMap(standardDescriptors.nextElement());
            merger.mergeOverride(map);
        }

        // 2. load from orm.xml within the jars
        // TODO: andrus, 4/20/2006 - load from the jar files

        // 3. load from explicitly specified descriptors
        for (String descriptor : unit.getMappingFileNames()) {

            // avoid loading duplicates, such as META-INF/orm.xml that is also explicitly
            // mentioned in the unit...
            if (loadedLocations.add(descriptor)) {

                Enumeration<URL> mappedDescriptors = context
                        .getTempClassLoader()
                        .getResources(descriptor);
                while (mappedDescriptors.hasMoreElements()) {
                    JpaEntityMap map = loader.getEntityMap(mappedDescriptors
                            .nextElement());
                    merger.mergeOverride(map);
                }
            }
        }
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

            addChildVisitor(JpaMappedSuperclass.class, new MappedSuperclassVisitor());
        }

        @Override
        public boolean onStartNode(ProjectPath path) {
            JpaEntityMap entityMap = (JpaEntityMap) path.getObject();

            // TODO: andrus, 4/28/2006 - actually we need to analyze preloaded classes and
            // see how they were annotated to choose the right access type...

            entityMap.setAccess(AccessType.FIELD);

            return true;
        }
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

            // name is formed as the concatenation of the following: the name of
            // the relationship property or field of entityA; "_" ; the name of
            // the primary key column in table B. The foreign key column has the
            // same type as the primary key of table B.

            JpaEntityMap map = (JpaEntityMap) path.firstInstanceOf(JpaEntityMap.class);
            JpaEntity target = map.entityForClass(relationship.getTargetEntityName());

            if (target == null) {
                context.recordConflict(new SimpleValidationFailure(
                        relationship,
                        "Invalid relationship target "
View Full Code Here

Examples of org.apache.cayenne.jpa.map.JpaEntityMap

            JpaManagedClass entity = (JpaManagedClass) path
                    .firstInstanceOf(JpaManagedClass.class);
            access = entity.getAccess();

            if (access == null) {
                JpaEntityMap map = (JpaEntityMap) path
                        .firstInstanceOf(JpaEntityMap.class);
                access = map.getAccess();
            }

            Class objectClass = ((ObjEntity) targetPath.firstInstanceOf(ObjEntity.class))
                    .getJavaClass();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.