Examples of EntityAccessor


Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

           
        // Reload the xml entity mappings object
        xmlEntityMappings = reloadXMLEntityMappingsObject(xmlEntityMappings);
           
        // Initialize the newly loaded/built entity
        EntityAccessor entity = xmlEntityMappings.getEntities().get(0);
        Class entityClass = getClassForName(entity.getClassName());
        entity.initXMLClassAccessor(new MetadataClass(entityClass, this), descriptor, m_project);
           
        return entity;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

     * with the subclasses context (that is, the descriptor we are given).
     */
    protected EntityAccessor reloadEntity(EntityAccessor entity, MetadataDescriptor descriptor) {
        if (m_accessibleObject.getEntityMappings() == null) {
            // Create a new EntityAccesor.
            EntityAccessor entityAccessor = new EntityAccessor(entity.getAnnotation(), entity.getJavaClass(), entity.getProject());
            // Things we care about ...
            descriptor.setDefaultAccess(entity.getDescriptor().getDefaultAccess());
            entityAccessor.setDescriptor(descriptor);
            return entityAccessor;           
        } else {
            return m_accessibleObject.getEntityMappings().reloadEntity(entity, descriptor);
        }
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

            Class candidateClass = PersistenceUnitProcessor.loadClass(className, m_loader, true, m_project);
            // Bug 227630: Do not process a null class whether it was from a
            // NPE or a CNF, a warning or exception is thrown in loadClass()
            if (candidateClass != null) {
                if (PersistenceUnitProcessor.isEntity(candidateClass) && ! m_project.hasEntity(candidateClass)) {
                    m_project.addEntityAccessor(new EntityAccessor(PersistenceUnitProcessor.getEntityAnnotation(candidateClass), candidateClass, m_project));
                } else if (PersistenceUnitProcessor.isEmbeddable(candidateClass) && ! m_project.hasEmbeddable(candidateClass)) {
                    m_project.addEmbeddableAccessor(new EmbeddableAccessor(PersistenceUnitProcessor.getEmbeddableAnnotation(candidateClass), candidateClass, m_project));
                }
            }
           
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

     * INTERNAL:
     * The process method method will be called with the descriptor from
     * every entity in the hierarchy.
     */
    public void process(MetadataDescriptor descriptor) {
        EntityAccessor accessor = (EntityAccessor) descriptor.getClassAccessor();
       
        // Set the correct inheritance policy.
        if (m_strategy != null && m_strategy.name().equals(InheritanceType.TABLE_PER_CLASS.name())) {
            setTablePerClassInheritancePolicy(descriptor);
        } else {
            setInheritancePolicy(descriptor);
        }
       
        // Process an inheritance subclass.
        if (descriptor.isInheritanceSubclass()) {
            MetadataDescriptor rootDescriptor = descriptor.getInheritanceRootDescriptor();
            EntityAccessor rootAccessor = (EntityAccessor) rootDescriptor.getClassAccessor();
                
            if (rootDescriptor.usesTablePerClassInheritanceStrategy()) {
                MetadataDescriptor parentDescriptor = descriptor.getInheritanceParentDescriptor();
                descriptor.getClassDescriptor().getTablePerClassPolicy().addParentDescriptor(parentDescriptor.getClassDescriptor());
                parentDescriptor.getClassDescriptor().getTablePerClassPolicy().addChildDescriptor(descriptor.getClassDescriptor());
            } else {
                // Set the parent class on the inheritance policy.
                descriptor.getClassDescriptor().getInheritancePolicy().setParentClassName(descriptor.getInheritanceParentDescriptor().getJavaClassName());               
            }
           
            // If we have inheritance defined then we are a root parent and the
            // strategy should be changing meaning we have double the work to do.
            // Note: if the strategy does not change, then we ignore the inheritance
            // hierarchy and continue as if we were a simple inheritance subclass.
            if (accessor.hasInheritance() && ! equals(rootAccessor.getInheritance())) {
                // If our parent was a table per class strategy then we need
                // to add the table per class mappings.
                if (rootDescriptor.usesTablePerClassInheritanceStrategy()) {
                    // Go through our parents (including their mapped superclasses
                    // and add their accessors to our list of accessors.
                    addTablePerClassParentMappings(descriptor, descriptor);
                } else {
                    if (! usesTablePerClassStrategy()) {
                        // We are either a JOINED or SINGLE_TABLE strategy and we
                        // need to process our specific inheritance metadata.
                        addClassIndicatorField(descriptor, accessor);
                        addClassIndicator(rootDescriptor, accessor);
                    }
                   
                    // The strategies are changing so must process some
                    // join columns to link up the classes.
                    accessor.processInheritancePrimaryKeyJoinColumns();
                }
            } else {
                // We are a simple inheritance subclass.
                if (usesTablePerClassStrategy()) {
                    // Go through our parents (including their mapped superclasses
                    // and add their accessors to our list of accessors.
                    addTablePerClassParentMappings(descriptor, descriptor);
                } else {
                    // We have metadata we need to set on our root parent.
                    addClassIndicator(rootDescriptor, accessor);
                   
                    // Process join columns if necessary.
                    if (rootAccessor.getInheritance().usesJoinedStrategy()) {
                        accessor.processInheritancePrimaryKeyJoinColumns();
                    }
                }
            }
           
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

     *   descriptor, they must be reloaded/cloned and cannot be shared.
     *   Otherwise the processing of those accessor will only be performed once
     *   by their 'real' owning entity accessor.
     */
    public void addTablePerClassParentMappings(MetadataDescriptor startingDescriptor, MetadataDescriptor realDescriptor) {
        EntityAccessor reloadedParentEntity = null;
        MetadataDescriptor realParentDescriptor = null;
       
        // If we are an inheritance subclass, recursively call up to the root
        // entity so that we can grab a copy of all our inherited mapping
        // accessors. Copies of our parent accessors are done by reloading the
        // parent entities through OX (if they were originally loaded from XML).
        // This is our way of cloning. The reloaded accessors are rebuilt using
        // the startingDescriptor context, that is where we want to add the
        // accessors.
        if (realDescriptor.isInheritanceSubclass() && realDescriptor.getInheritanceRootDescriptor().usesTablePerClassInheritanceStrategy()) {
            realParentDescriptor = realDescriptor.getInheritanceParentDescriptor();
            reloadedParentEntity = reloadEntity((EntityAccessor) realParentDescriptor.getClassAccessor(), startingDescriptor);
            addTablePerClassParentMappings(startingDescriptor, realParentDescriptor);
        }
       
        // If we are the starting entity, the processing of our mapped
        // superclass and our accessors will be done when we process our
        // immediate accessors. Also, our immediate mapped superclasses will
        // have other metadata for us to process (and not just the addition of
        // accessors). See EntityAccesor process() and processClassMetadata().
        if (reloadedParentEntity != null) {
            // Be sure to reload the mapped superclass from the 'real' entity
            // accessor which has already discovered the list.
            EntityAccessor realParentEntityAccessor = (EntityAccessor) realParentDescriptor.getClassAccessor();
           
            for (MappedSuperclassAccessor mappedSuperclass : realParentEntityAccessor.getMappedSuperclasses()) {
                // Reload the mapped superclass and add its accessors.
                reloadMappedSuperclass(mappedSuperclass, startingDescriptor).addAccessors();
            }
           
            // Add the mapping accessors from the reloaded entity.
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

                MetadataClass candidateClass = m_factory.getMetadataClass(className, unlisted);
                // JBoss Bug 227630: Do not process a null class whether it was from a
                // NPE or a CNF, a warning or exception is thrown in loadClass()
                if (candidateClass != null) {
                    if (PersistenceUnitProcessor.isEntity(candidateClass) && ! m_project.hasEntity(candidateClass) && ! m_project.hasEmbeddable(candidateClass)) {
                        m_project.addEntityAccessor(new EntityAccessor(PersistenceUnitProcessor.getEntityAnnotation(candidateClass), candidateClass, m_project));
                    } else if (PersistenceUnitProcessor.isEmbeddable(candidateClass) && ! m_project.hasEmbeddable(candidateClass) && ! m_project.hasEntity(candidateClass)) {
                        m_project.addEmbeddableAccessor(new EmbeddableAccessor(PersistenceUnitProcessor.getEmbeddableAnnotation(candidateClass), candidateClass, m_project));
                    } else if (PersistenceUnitProcessor.isStaticMetamodelClass(candidateClass)) {
                        m_project.addStaticMetamodelClass(PersistenceUnitProcessor.getStaticMetamodelAnnotation(candidateClass), candidateClass);
                    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

            Class candidateClass = PersistenceUnitProcessor.loadClass(className, m_loader, true, m_project);
            // Bug 227630: Do not process a null class whether it was from a
            // NPE or a CNF, a warning or exception is thrown in loadClass()
            if (candidateClass != null) {
                if (PersistenceUnitProcessor.isEntity(candidateClass) && ! m_project.hasEntity(candidateClass)) {
                    m_project.addEntityAccessor(new EntityAccessor(PersistenceUnitProcessor.getEntityAnnotation(candidateClass), candidateClass, m_project));
                } else if (PersistenceUnitProcessor.isEmbeddable(candidateClass) && ! m_project.hasEmbeddable(candidateClass)) {
                    m_project.addEmbeddableAccessor(new EmbeddableAccessor(PersistenceUnitProcessor.getEmbeddableAnnotation(candidateClass), candidateClass, m_project));
                }
            }
           
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

           
        // Reload the xml entity mappings object
        xmlEntityMappings = reloadXMLEntityMappingsObject(xmlEntityMappings);
           
        // Initialize the newly loaded/built entity
        EntityAccessor entity = xmlEntityMappings.getEntities().get(0);
        Class entityClass = getClassForName(entity.getClassName());
        entity.initXMLClassAccessor(new MetadataClass(entityClass, this), descriptor, m_project);
           
        return entity;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

     * INTERNAL:
     * The process method method will be called with the descriptor from
     * every entity in the hierarchy.
     */
    public void process(MetadataDescriptor descriptor) {
        EntityAccessor accessor = (EntityAccessor) descriptor.getClassAccessor();
       
        // Set the correct inheritance policy.
        if (m_strategy != null && m_strategy.name().equals(InheritanceType.TABLE_PER_CLASS.name())) {
            setTablePerClassInheritancePolicy(descriptor);
        } else {
            setInheritancePolicy(descriptor);
        }
       
        // Process an inheritance subclass.
        if (descriptor.isInheritanceSubclass()) {
            MetadataDescriptor rootDescriptor = descriptor.getInheritanceRootDescriptor();
            EntityAccessor rootAccessor = (EntityAccessor) rootDescriptor.getClassAccessor();
                
            if (rootDescriptor.usesTablePerClassInheritanceStrategy()) {
                MetadataDescriptor parentDescriptor = descriptor.getInheritanceParentDescriptor();
                descriptor.getClassDescriptor().getTablePerClassPolicy().addParentDescriptor(parentDescriptor.getClassDescriptor());
                parentDescriptor.getClassDescriptor().getTablePerClassPolicy().addChildDescriptor(descriptor.getClassDescriptor());
            } else {
                // Set the parent class on the inheritance policy.
                descriptor.getClassDescriptor().getInheritancePolicy().setParentClassName(descriptor.getInheritanceParentDescriptor().getJavaClassName());               
            }
           
            // If we have inheritance defined then we are a root parent and the
            // strategy should be changing meaning we have double the work to do.
            // Note: if the strategy does not change, then we ignore the inheritance
            // hierarchy and continue as if we were a simple inheritance subclass.
            if (accessor.hasInheritance() && ! equals(rootAccessor.getInheritance())) {
                // If our parent was a table per class strategy then we need
                // to add the table per class mappings.
                if (rootDescriptor.usesTablePerClassInheritanceStrategy()) {
                    // Go through our parents (including their mapped superclasses
                    // and add their accessors to our list of accessors.
                    addTablePerClassParentMappings(descriptor, descriptor);
                } else {
                    if (! usesTablePerClassStrategy()) {
                        // We are either a JOINED or SINGLE_TABLE strategy and we
                        // need to process our specific inheritance metadata.
                        addClassIndicatorField(descriptor, accessor);
                        addClassIndicator(rootDescriptor, accessor);
                    }
                   
                    // The strategies are changing so must process some
                    // join columns to link up the classes.
                    accessor.processInheritancePrimaryKeyJoinColumns();
                }
            } else {
                // We are a simple inheritance subclass.
                if (usesTablePerClassStrategy()) {
                    // Go through our parents (including their mapped superclasses
                    // and add their accessors to our list of accessors.
                    addTablePerClassParentMappings(descriptor, descriptor);
                } else {
                    // We have metadata we need to set on our root parent.
                    addClassIndicator(rootDescriptor, accessor);
                   
                    // Process join columns if necessary.
                    if (rootAccessor.getInheritance().usesJoinedStrategy()) {
                        accessor.processInheritancePrimaryKeyJoinColumns();
                    }
                }
            }
           
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor

     *   descriptor, they must be reloaded/cloned and cannot be shared.
     *   Otherwise the processing of those accessor will only be performed once
     *   by their 'real' owning entity accessor.
     */
    public void addTablePerClassParentMappings(MetadataDescriptor startingDescriptor, MetadataDescriptor realDescriptor) {
        EntityAccessor reloadedParentEntity = null;
        MetadataDescriptor realParentDescriptor = null;
       
        // If we are an inheritance subclass, recursively call up to the root
        // entity so that we can grab a copy of all our inherited mapping
        // accessors. Copies of our parent accessors are done by reloading the
        // parent entities through OX (if they were originally loaded from XML).
        // This is our way of cloning. The reloaded accessors are rebuilt using
        // the startingDescriptor context, that is where we want to add the
        // accessors.
        if (realDescriptor.isInheritanceSubclass() && realDescriptor.getInheritanceRootDescriptor().usesTablePerClassInheritanceStrategy()) {
            realParentDescriptor = realDescriptor.getInheritanceParentDescriptor();
            reloadedParentEntity = reloadEntity((EntityAccessor) realParentDescriptor.getClassAccessor(), startingDescriptor);
            addTablePerClassParentMappings(startingDescriptor, realParentDescriptor);
        }
       
        // If we are the starting entity, the processing of our mapped
        // superclass and our accessors will be done when we process our
        // immediate accessors. Also, our immediate mapped superclasses will
        // have other metadata for us to process (and not just the addition of
        // accessors). See EntityAccesor process() and processClassMetadata().
        if (reloadedParentEntity != null) {
            // Be sure to reload the mapped superclass from the 'real' entity
            // accessor which has already discovered the list.
            EntityAccessor realParentEntityAccessor = (EntityAccessor) realParentDescriptor.getClassAccessor();
           
            for (MappedSuperclassAccessor mappedSuperclass : realParentEntityAccessor.getMappedSuperclasses()) {
                // Reload the mapped superclass and add its accessors.
                reloadMappedSuperclass(mappedSuperclass, startingDescriptor).addAccessors();
            }
           
            // Add the mapping accessors from the reloaded entity.
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.