Examples of JpaVersion


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

    class JpaVersionVisitor extends JpaBasicVisitor {

        @Override
        Object createObject(ProjectPath path) {

            JpaVersion version = (JpaVersion) path.getObject();

            ObjEntity parentCayenneEntity = (ObjEntity) targetPath.getObject();

            ObjAttribute cayenneAttribute = new ObjAttribute(version.getName());
            cayenneAttribute.setType(getAttributeType(path, version.getName()).getName());
            cayenneAttribute.setDbAttributeName(version.getColumn().getName());

            parentCayenneEntity.addAttribute(cayenneAttribute);
            return cayenneAttribute;
        }
View Full Code Here

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

            if (attribute instanceof JpaBasic) {
                JpaBasic basic = (JpaBasic) attribute;
                dbAttribute.setType(basic.getDefaultJdbcType());
            }
            else if (attribute instanceof JpaVersion) {
                JpaVersion version = (JpaVersion) attribute;
                dbAttribute.setType(version.getDefaultJdbcType());
            }

            dbAttribute.setMandatory(!jpaColumn.isNullable());
            dbAttribute.setMaxLength(jpaColumn.getLength());
View Full Code Here

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

        @Override
        void onManagedClass(
                JpaManagedClass managedClass,
                AnnotatedElement element,
                AnnotationProcessorStack context) {
            JpaVersion attribute = new JpaVersion();
            managedClass.getAttributes().getVersionAttributes().add(attribute);
            context.push(attribute);
        }
View Full Code Here

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

    class VersionVisitor extends BasicVisitor {

        @Override
        public boolean onStartNode(ProjectPath path) {
            JpaVersion jpaBasic = (JpaVersion) path.getObject();
            if (jpaBasic.getColumn() == null) {
                JpaColumn column = new JpaColumn(AnnotationPrototypes.getColumn());
                column.setName(jpaBasic.getName());
                jpaBasic.setColumn(column);
            }

            if (jpaBasic.getTemporal() == null) {
                JpaEntity entity = (JpaEntity) path.firstInstanceOf(JpaEntity.class);
                JpaClassDescriptor descriptor = entity.getClassDescriptor();
                JpaPropertyDescriptor property = descriptor.getProperty(jpaBasic
                        .getName());

                if (Date.class.equals(property.getType())) {
                    jpaBasic.setTemporal(TemporalType.TIMESTAMP);
                }
            }

            return true;
        }
View Full Code Here

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

        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.JpaVersion

        assertNotNull(attributes.getBasicAttribute("attribute12"));
        assertTrue(attributes.getBasicAttribute("attribute12").isLob());

        // VERSION
        assertEquals(1, attributes.getVersionAttributes().size());
        JpaVersion a1 = attributes.getVersionAttributes().iterator().next();
        assertEquals("attribute2", a1.getName());

        // ONE-TO_ONE
        assertEquals(1, attributes.getOneToOneRelationships().size());
        JpaOneToOne a2 = attributes.getOneToOneRelationship("attribute3");
        assertEquals("attribute3", a2.getName());
View Full Code Here

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

        if (attribute instanceof JpaBasic) {
            JpaBasic basic = (JpaBasic) attribute;
            dbAttribute.setType(basic.getDefaultJdbcType());
        }
        else if (attribute instanceof JpaVersion) {
            JpaVersion version = (JpaVersion) attribute;
            dbAttribute.setType(version.getDefaultJdbcType());
        }

        dbAttribute.setMandatory(!column.isNullable());
        dbAttribute.setMaxLength(column.getLength());
View Full Code Here

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

        @Override
        Object createObject(ProjectPath path) {

            JpaManagedClass entity = path.firstInstanceOf(JpaManagedClass.class);
            JpaVersion version = (JpaVersion) path.getObject();

            ObjEntity parentCayenneEntity = (ObjEntity) targetPath.getObject();

            ObjAttribute cayenneAttribute = new ObjAttribute(version.getName());
            cayenneAttribute.setType(getAttributeType(path, version.getName()).getName());
            cayenneAttribute.setDbAttributePath(getAttributePath(path, entity, version
                    .getColumn()));

            parentCayenneEntity.addAttribute(cayenneAttribute);
            return cayenneAttribute;
        }
View Full Code Here

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

            if (attribute instanceof JpaBasic) {
                JpaBasic basic = (JpaBasic) attribute;
                dbAttribute.setType(basic.getDefaultJdbcType());
            }
            else if (attribute instanceof JpaVersion) {
                JpaVersion version = (JpaVersion) attribute;
                dbAttribute.setType(version.getDefaultJdbcType());
            }

            dbAttribute.setMandatory(!jpaColumn.isNullable());
            dbAttribute.setMaxLength(jpaColumn.getLength());
View Full Code Here

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

    class VersionVisitor extends BasicVisitor {

        @Override
        public boolean onStartNode(ProjectPath path) {
            JpaVersion jpaBasic = (JpaVersion) path.getObject();
            if (jpaBasic.getColumn() == null) {
                JpaColumn column = new JpaColumn(AnnotationPrototypes.getColumn());
                column.setName(jpaBasic.getName());
                jpaBasic.setColumn(column);
            }

            if (jpaBasic.getTemporal() == null) {
                JpaEntity entity = (JpaEntity) path.firstInstanceOf(JpaEntity.class);
                JpaClassDescriptor descriptor = entity.getClassDescriptor();
                JpaPropertyDescriptor property = descriptor.getProperty(jpaBasic
                        .getName());

                if (Date.class.equals(property.getType())) {
                    jpaBasic.setTemporal(TemporalType.TIMESTAMP);
                }
            }

            return true;
        }
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.