Examples of JpaEntityMap


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

        public void onFinishElement(
                AnnotatedElement element,
                AnnotationProcessorStack context) {
            JpaMappedSuperclass superclass = (JpaMappedSuperclass) context.pop();
            JpaEntityMap entityMap = (JpaEntityMap) context.peek();
            entityMap.getMappedSuperclasses().add(superclass);
        }
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

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

        EntityMapXMLLoader loader = new EntityMapXMLLoader(
                getClass().getClassLoader(),
                true);

        // long t0 = System.currentTimeMillis();
        JpaEntityMap map = loader.getEntityMap(resourceLoader
                .getResource("xml-samples/orm-schema-headers-full.xml"));
        // long t1 = System.currentTimeMillis();
        // System.out.println("Load time: " + (t1 - t0));

        new XMLMappingAssertion().testEntityMap(map);
View Full Code Here

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

        loader.loadClassMapping(MockAnnotatedBeanVersion.class);

        // apply defaults
        new EntityMapDefaultsProcessor().applyDefaults(context);

        JpaEntityMap map = context.getEntityMap();
        JpaEntity entity = map.entityForClass(MockAnnotatedBeanVersion.class);
        assertNotNull(entity);

        JpaVersion v = entity.getAttributes().getVersionAttribute("attribute1");
        assertNotNull(v);
        assertNotNull(v.getColumn());
View Full Code Here

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

        loader.loadClassMapping(MockAnnotatedBean4.class);

        // apply defaults
        new EntityMapDefaultsProcessor().applyDefaults(context);

        JpaEntityMap map = context.getEntityMap();
        assertEquals(1, map.getEntities().size());
        JpaEntity entity = map.getEntities().iterator().next();

        // testing that static fields are not loaded as persistent
        assertEquals(1, entity.getAttributes().size());
        assertEquals(1, entity.getAttributes().getIds().size());
    }
View Full Code Here

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

public class DataMapConverterTest extends TestCase {

    public void testDefaultEntityListeners() {
        EntityMapLoaderContext context = new EntityMapLoaderContext(
                new MockPersistenceUnitInfo());
        JpaEntityMap jpaMap = context.getEntityMap();

        JpaPersistenceUnitMetadata metadata = new JpaPersistenceUnitMetadata();
        jpaMap.setPersistenceUnitMetadata(metadata);

        JpaPersistenceUnitDefaults defaults = new JpaPersistenceUnitDefaults();
        metadata.setPersistenceUnitDefaults(defaults);

        JpaEntityListeners listeners = new JpaEntityListeners();
View Full Code Here

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

    }

    public void testEntityCallbackMethods() {
        EntityMapLoaderContext context = new EntityMapLoaderContext(
                new MockPersistenceUnitInfo());
        JpaEntityMap jpaMap = context.getEntityMap();

        JpaTable table = new JpaTable();
        table.setName("ET1");
       
        JpaEntity jpaEntity = new JpaEntity();
        jpaEntity.setName("E1");
        jpaEntity.setClassName("abc.C2");
        jpaEntity.setTable(table);
        jpaEntity.setPostLoad(new JpaLifecycleCallback("xpl2"));
        jpaEntity.setPreRemove(new JpaLifecycleCallback("xpr2"));
        jpaMap.getEntities().add(jpaEntity);

        DataMap cayenneMap = new DataMapConverter().toDataMap("n1", context);

        ObjEntity entity = cayenneMap.getObjEntity("E1");
        assertNotNull(entity);
View Full Code Here

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

    }

    public void testEntityListeners() {
        EntityMapLoaderContext context = new EntityMapLoaderContext(
                new MockPersistenceUnitInfo());
        JpaEntityMap jpaMap = context.getEntityMap();

        JpaTable table = new JpaTable();
        table.setName("ET1");
       
        JpaEntity jpaEntity = new JpaEntity();
        jpaEntity.setName("E1");
        jpaEntity.setClassName("abc.C2");
        jpaEntity.setTable(table);
        jpaEntity.setPostLoad(new JpaLifecycleCallback("xpl2"));
        jpaEntity.setPreRemove(new JpaLifecycleCallback("xpr2"));
        jpaMap.getEntities().add(jpaEntity);

        JpaEntityListeners listeners = new JpaEntityListeners();
        jpaEntity.setEntityListeners(listeners);

        JpaEntityListener l1 = new JpaEntityListener();
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.