Examples of JpaBasic


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

            JpaAttribute attribute) {

        DbAttribute dbAttribute = new DbAttribute(column.getName());

        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());
        }
View Full Code Here

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

    class JpaEmbeddableBasicVisitor extends NestedVisitor {

        @Override
        Object createObject(ProjectPath path) {
            JpaBasic jpaBasic = (JpaBasic) path.getObject();

            Embeddable embeddable = (Embeddable) targetPath.getObject();

            EmbeddableAttribute attribute = new EmbeddableAttribute(jpaBasic.getName());
            attribute.setType(getAttributeType(path, jpaBasic.getName()).getName());
            attribute.setDbAttributeName(jpaBasic.getColumn().getName());

            embeddable.addAttribute(attribute);
            return attribute;
        }
View Full Code Here

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

        @Override
        Object createObject(ProjectPath path) {

            JpaManagedClass entity = path.firstInstanceOf(JpaManagedClass.class);
            JpaBasic jpaBasic = (JpaBasic) path.getObject();

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

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

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

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

    class JpaEmbeddableBasicVisitor extends NestedVisitor {

        @Override
        Object createObject(ProjectPath path) {
            JpaBasic jpaBasic = (JpaBasic) path.getObject();

            Embeddable embeddable = (Embeddable) targetPath.getObject();

            EmbeddableAttribute attribute = new EmbeddableAttribute(jpaBasic.getName());
            attribute.setType(getAttributeType(path, jpaBasic.getName()).getName());
            attribute.setDbAttributeName(jpaBasic.getColumn().getName());

            embeddable.addAttribute(attribute);
            return attribute;
        }
View Full Code Here

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

        @Override
        Object createObject(ProjectPath path) {

            JpaManagedClass entity = path.firstInstanceOf(JpaManagedClass.class);
            JpaBasic jpaBasic = (JpaBasic) path.getObject();

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

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

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

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

        JpaAttribute findOrCreateAttribute(
                AnnotatedElement element,
                Object parent,
                AnnotationProcessorStack context) {

            JpaBasic basic = null;

            if (parent instanceof JpaManagedClass) {
                JpaManagedClass managedClass = (JpaManagedClass) parent;
                String name = ((Member) element).getName();
                basic = managedClass.getAttributes().getBasicAttribute(name);
                if (basic == null) {
                    basic = new JpaBasic();

                    // do push/pop as the context does some required injection
                    context.push(basic);
                    context.pop();
View Full Code Here

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

        @Override
        void onManagedClass(
                JpaManagedClass managedClass,
                AnnotatedElement element,
                AnnotationProcessorStack context) {
            JpaBasic attribute = new JpaBasic(element.getAnnotation(Basic.class));
            managedClass.getAttributes().getBasicAttributes().add(attribute);
            context.push(attribute);
        }
View Full Code Here

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

            addChildVisitor(JpaColumn.class, new ColumnVisitor());
        }

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

            return true;
        }
View Full Code Here

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

            addChildVisitor(JpaColumn.class, new ColumnVisitor());
        }

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

            JpaAbstractEntity entity = (JpaAbstractEntity) path
                    .firstInstanceOf(JpaAbstractEntity.class);

            // process temporal type defaults
            if (jpaBasic.getTemporal() == null && jpaBasic.getEnumerated() == null) {
                JpaClassDescriptor descriptor = entity.getClassDescriptor();
                JpaPropertyDescriptor property = descriptor.getProperty(jpaBasic
                        .getName());

                // sanity check
                if (property == null) {
                    throw new IllegalStateException("No class property found for name: "
                            + jpaBasic.getName());
                }

                if (java.sql.Date.class.isAssignableFrom(property.getType())) {
                    jpaBasic.setTemporal(TemporalType.DATE);
                }
                else if (Time.class.isAssignableFrom(property.getType())) {
                    jpaBasic.setTemporal(TemporalType.TIME);
                }
                else if (Timestamp.class.isAssignableFrom(property.getType())) {
                    jpaBasic.setTemporal(TemporalType.TIMESTAMP);
                }
                else if (Date.class.isAssignableFrom(property.getType())) {
                    jpaBasic.setTemporal(TemporalType.TIMESTAMP);
                }
                else if (property.getType().isEnum()) {
                    jpaBasic.setEnumerated(EnumType.ORDINAL);
                }
            }

            return true;
        }
View Full Code Here

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

                return;
            }

            if (property.isDefaultNonRelationalType()) {

                JpaBasic attribute = new JpaBasic();

                attribute.setPropertyDescriptor(property);
                attribute.setName(property.getName());
                attributes.getBasicAttributes().add(attribute);
            }
            else {
                String path = descriptor.getManagedClass().getName()
                        + "."
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.