Examples of MappedSuperclass


Examples of javax.persistence.MappedSuperclass

        ClassMetaData meta = (m == null) ? getMetaData() : m;
        if (meta == null)
            return null;

        Entity entity = _cls.getAnnotation(Entity.class);
        MappedSuperclass mapped = _cls.getAnnotation(MappedSuperclass.class);
        Embeddable embeddable = _cls.getAnnotation(Embeddable.class);
        if (isMetaDataMode()) {
            meta.setAbstract(mapped != null);
            if (embeddable != null) meta.setEmbeddable();
            // while the spec only provides for embedded exclusive, it doesn't
View Full Code Here

Examples of javax.persistence.MappedSuperclass

        ClassMetaData meta = (m == null) ? getMetaData() : m;
        if (meta == null)
            return null;

        Entity entity = _cls.getAnnotation(Entity.class);
        MappedSuperclass mapped = _cls.getAnnotation(MappedSuperclass.class);
        Embeddable embeddable = _cls.getAnnotation(Embeddable.class);
        if (isMetaDataMode()) {
            meta.setAbstract(mapped != null);
            if (embeddable != null) meta.setEmbeddable();
            // while the spec only provides for embedded exclusive, it doesn't
View Full Code Here

Examples of javax.persistence.MappedSuperclass

        ClassMetaData meta = (m == null) ? getMetaData() : m;
        if (meta == null)
            return null;

        Entity entity = _cls.getAnnotation(Entity.class);
        MappedSuperclass mapped = _cls.getAnnotation(MappedSuperclass.class);
        Embeddable embeddable = _cls.getAnnotation(Embeddable.class);
        if (isMetaDataMode()) {
            meta.setAbstract(mapped != null);
            if (embeddable != null) meta.setEmbeddable();
            // while the spec only provides for embedded exclusive, it doesn't
View Full Code Here

Examples of javax.persistence.MappedSuperclass

        ClassMetaData meta = (m == null) ? getMetaData() : m;
        if (meta == null)
            return null;

        Entity entity = _cls.getAnnotation(Entity.class);
        MappedSuperclass mapped = _cls.getAnnotation(MappedSuperclass.class);
        Embeddable embeddable = _cls.getAnnotation(Embeddable.class);
        if (isMetaDataMode()) {
            meta.setAbstract(mapped != null);
            if (embeddable != null) meta.setEmbeddable();
            // while the spec only provides for embedded exclusive, it doesn't
View Full Code Here

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.MappedSuperclass

    {
        if ( !this.mappedClasses.contains( c.implClass.binaryName() )
             && c.target.getCustomizations().find( ORM_NS, "mapped-superclass" ) != null )
        {
            final CPluginCustomization pc = c.target.getCustomizations().find( ORM_NS, "mapped-superclass" );
            final MappedSuperclass mappedSuperclass =
                JAXB.unmarshal( new DOMSource( pc.element ), MappedSuperclass.class );

            orm.getMappedSuperclass().add( mappedSuperclass );
            this.toMappedSuperclass( outline, c, orm, mappedSuperclass );

            if ( !pc.isAcknowledged() )
            {
                pc.markAsAcknowledged();
            }

            this.mappedClasses.add( mappedSuperclass.getClazz() );
        }
    }
View Full Code Here

Examples of net.sourceforge.jpaxjc.ns.persistence.orm.MappedSuperclass

                    orm.getSqlResultSetMapping().add( e );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "mapped-superclass" ) )
                {
                    final MappedSuperclass e = JAXB.unmarshal( new DOMSource( c.element ), MappedSuperclass.class );
                    orm.getMappedSuperclass().add( e );
                    acknowledge = true;
                }
                else if ( c.element.getLocalName().equals( "entity" ) )
                {
View Full Code Here

Examples of org.apache.openejb.jee.jpa.MappedSuperclass

        // id: the primary key
        //
        Set<String> primaryKeyFields = new HashSet<String>();
        if (bean.getPrimkeyField() != null) {
            String fieldName = bean.getPrimkeyField();
            MappedSuperclass superclass = superclassByField.get(fieldName);
            if (superclass == null) {
                throw new IllegalStateException("Primary key field " + fieldName + " is not defined in class " + ejbClassName + " or any super classes");
            }
            superclass.addField(new Id(fieldName));
            mapping.addField(new AttributeOverride(fieldName));
            primaryKeyFields.add(fieldName);
        } else if ("java.lang.Object".equals(bean.getPrimKeyClass())) {
            String fieldName = "OpenEJB_pk";
            Id field = new Id(fieldName);
            field.setGeneratedValue(new GeneratedValue(GenerationType.AUTO));
            mapping.addField(field);
        } else if (bean.getPrimKeyClass() != null) {
            Class<?> pkClass = null;
            try {
                pkClass = classLoader.loadClass(bean.getPrimKeyClass());
                MappedSuperclass superclass = null;
                for (java.lang.reflect.Field pkField : pkClass.getFields()) {
                    String fieldName = pkField.getName();
                    int modifiers = pkField.getModifiers();
                    if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers) && allFields.contains(fieldName)) {
                        superclass = superclassByField.get(fieldName);
                        if (superclass == null) {
                            throw new IllegalStateException("Primary key field " + fieldName + " is not defined in class " + ejbClassName + " or any super classes");
                        }
                        superclass.addField(new Id(fieldName));
                        mapping.addField(new AttributeOverride(fieldName));
                        primaryKeyFields.add(fieldName);
                    }
                }
                if (superclass != null) {
                    superclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (ClassNotFoundException e) {
                // todo throw exception
            }
        }

        //
        // basic: cmp-fields
        //
        for (CmpField cmpField : bean.getCmpField()) {
            String fieldName = cmpField.getFieldName();
            if (!primaryKeyFields.contains(fieldName)) {
                MappedSuperclass superclass = superclassByField.get(fieldName);
                if (superclass == null) {
                    throw new IllegalStateException("Primary key field " + fieldName + " is not defined in class " + ejbClassName + " or any super classes");
                }
                superclass.addField(new Basic(fieldName));
                mapping.addField(new AttributeOverride(fieldName));
            }
        }

        return new HashSet<MappedSuperclass>(superclassByField.values());
View Full Code Here

Examples of org.apache.openejb.jee.jpa.MappedSuperclass

    private Map<String, MappedSuperclass> mapFields(Class clazz, Set<String> persistantFields) {
        persistantFields = new TreeSet<String>(persistantFields);
        Map<String,MappedSuperclass> fields = new TreeMap<String,MappedSuperclass>();

        while (!persistantFields.isEmpty() && !clazz.equals(Object.class)) {
            MappedSuperclass superclass = new MappedSuperclass(clazz.getName());
            for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {
                String fieldName = field.getName();
                if (persistantFields.contains(fieldName)) {
                    fields.put(fieldName, superclass);
                    persistantFields.remove(fieldName);
                } else if (!ENHANCEED_FIELDS.contains(fieldName)){
                    Transient transientField = new Transient(fieldName);
                    superclass.addField(transientField);
                }
            }
            clazz = clazz.getSuperclass();
        }
View Full Code Here

Examples of org.apache.openejb.jee.jpa.MappedSuperclass

        // id: the primary key
        //
        Set<String> primaryKeyFields = new HashSet<String>();
        if (bean.getPrimkeyField() != null) {
            String fieldName = bean.getPrimkeyField();
            MappedSuperclass superclass = superclassByField.get(fieldName);
            if (superclass == null) {
                throw new IllegalStateException("Primary key field " + fieldName + " is not defined in class " + ejbClassName + " or any super classes");
            }
            superclass.addField(new Id(fieldName));
            mapping.addField(new AttributeOverride(fieldName));
            primaryKeyFields.add(fieldName);
        } else if ("java.lang.Object".equals(bean.getPrimKeyClass())) {
            String fieldName = "OpenEJB_pk";
            Id field = new Id(fieldName);
            field.setGeneratedValue(new GeneratedValue(GenerationType.AUTO));
            mapping.addField(field);
        } else if (bean.getPrimKeyClass() != null) {
            Class<?> pkClass = null;
            try {
                pkClass = classLoader.loadClass(bean.getPrimKeyClass());
                MappedSuperclass superclass = null;
                for (java.lang.reflect.Field pkField : pkClass.getFields()) {
                    String fieldName = pkField.getName();
                    int modifiers = pkField.getModifiers();
                    if (Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers) && allFields.contains(fieldName)) {
                        superclass = superclassByField.get(fieldName);
                        if (superclass == null) {
                            throw new IllegalStateException("Primary key field " + fieldName + " is not defined in class " + ejbClassName + " or any super classes");
                        }
                        superclass.addField(new Id(fieldName));
                        mapping.addField(new AttributeOverride(fieldName));
                        primaryKeyFields.add(fieldName);
                    }
                }
                if (superclass != null) {
                    superclass.setIdClass(new IdClass(bean.getPrimKeyClass()));
                }
            } catch (ClassNotFoundException e) {
                // todo throw exception
            }
        }

        //
        // basic: cmp-fields
        //
        for (CmpField cmpField : bean.getCmpField()) {
            String fieldName = cmpField.getFieldName();
            if (!primaryKeyFields.contains(fieldName)) {
                MappedSuperclass superclass = superclassByField.get(fieldName);
                if (superclass == null) {
                    throw new IllegalStateException("Primary key field " + fieldName + " is not defined in class " + ejbClassName + " or any super classes");
                }
                superclass.addField(new Basic(fieldName));
                mapping.addField(new AttributeOverride(fieldName));
            }
        }

        return new HashSet<MappedSuperclass>(superclassByField.values());
View Full Code Here

Examples of org.apache.openejb.jee.jpa.MappedSuperclass

    private Map<String, MappedSuperclass> mapFields(Class clazz, Set<String> persistantFields) {
        persistantFields = new TreeSet<String>(persistantFields);
        Map<String,MappedSuperclass> fields = new TreeMap<String,MappedSuperclass>();

        while (!persistantFields.isEmpty() && !clazz.equals(Object.class)) {
            MappedSuperclass superclass = new MappedSuperclass(clazz.getName());
            for (java.lang.reflect.Field field : clazz.getDeclaredFields()) {
                String fieldName = field.getName();
                if (persistantFields.contains(fieldName)) {
                    fields.put(fieldName, superclass);
                    persistantFields.remove(fieldName);
                } else if (!ENHANCEED_FIELDS.contains(fieldName)){
                    Transient transientField = new Transient(fieldName);
                    superclass.addField(transientField);
                }
            }
            clazz = clazz.getSuperclass();
        }
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.