This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
View | Details | Raw Unified | Return to bug 266912 | Differences between
and this patch

Collapse All | Expand All

(-)foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/localization/i18n/ExceptionLocalizationResource.java (-1 / +2 lines)
Lines 118-124 Link Here
118
                                           { "metamodel_identifiable_version_attribute_type_incorrect", "Expected version attribute type [{2}] on the existing version attribute [{0}] on the identifiable type [{1}] but found attribute type [{3}]." },
118
                                           { "metamodel_identifiable_version_attribute_type_incorrect", "Expected version attribute type [{2}] on the existing version attribute [{0}] on the identifiable type [{1}] but found attribute type [{3}]." },
119
                                           { "metamodel_identifiable_id_attribute_type_incorrect", "Expected id attribute type [{2}] on the existing id attribute [{0}] on the identifiable type [{1}] but found attribute type [{3}]." },
119
                                           { "metamodel_identifiable_id_attribute_type_incorrect", "Expected id attribute type [{2}] on the existing id attribute [{0}] on the identifiable type [{1}] but found attribute type [{3}]." },
120
                                           { "metamodel_managed_type_declared_attribute_not_present_but_is_on_superclass", "The declared attribute [{0}] from the managed type [{1}] is not present - however, it is declared on a superclass." },
120
                                           { "metamodel_managed_type_declared_attribute_not_present_but_is_on_superclass", "The declared attribute [{0}] from the managed type [{1}] is not present - however, it is declared on a superclass." },
121
                                           { "metamodel_managed_type_attribute_return_type_incorrect", "Expected attribute return type [{2}] on the existing attribute [{0}] on the managed type [{1}] but found attribute return type [{3}]." }                                           
121
                                           { "metamodel_managed_type_attribute_return_type_incorrect", "Expected attribute return type [{2}] on the existing attribute [{0}] on the managed type [{1}] but found attribute return type [{3}]." },
122
                                           { "metamodel_incompatible_persistence_config_for_getIdType", "Incompatible persistence configuration getting Metamodel Id Type for the ManagedType [{0}]." }                                           
122
    };
123
    };
123
124
124
    /**
125
    /**
(-)jpa/eclipselink.jpa.test/src/org/eclipse/persistence/testing/tests/jpa/FullRegressionTestSuite.java (+9 lines)
Lines 201-206 Link Here
201
201
202
        // JPA 2.0 Metamodel model
202
        // JPA 2.0 Metamodel model
203
        fullSuite.addTest(org.eclipse.persistence.testing.tests.jpa.metamodel.MetamodelTestSuite.suite());
203
        fullSuite.addTest(org.eclipse.persistence.testing.tests.jpa.metamodel.MetamodelTestSuite.suite());
204
205
        // JPA 2.0 Criteria JPQL model
206
        suite = new TestSuite();
207
        suite.setName("Criteria");
208
        suite.addTest(org.eclipse.persistence.testing.tests.jpa.criteria.JUnitCriteriaUnitTestSuite.suite());
209
        suite.addTest(org.eclipse.persistence.testing.tests.jpa.criteria.AdvancedCompositePKJunitTest.suite());
210
        suite.addTest(org.eclipse.persistence.testing.tests.jpa.criteria.AdvancedQueryTestSuite.suite());
211
        suite.addTest(org.eclipse.persistence.testing.tests.jpa.criteria.JUnitCriteriaSimpleTestSuite.suite());        
212
        fullSuite.addTest(suite);
204
        
213
        
205
        // JPA 2.0 Cacheable model
214
        // JPA 2.0 Cacheable model
206
        fullSuite.addTest(CacheableModelJunitTest.suite());
215
        fullSuite.addTest(CacheableModelJunitTest.suite());
(-)jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metamodel/MapAttributeImpl.java (-6 / +46 lines)
Lines 19-26 Link Here
19
import javax.persistence.metamodel.MapAttribute;
19
import javax.persistence.metamodel.MapAttribute;
20
import javax.persistence.metamodel.Type;
20
import javax.persistence.metamodel.Type;
21
21
22
import org.eclipse.persistence.descriptors.ClassDescriptor;
23
import org.eclipse.persistence.descriptors.RelationalDescriptor;
22
import org.eclipse.persistence.internal.queries.MapContainerPolicy;
24
import org.eclipse.persistence.internal.queries.MapContainerPolicy;
25
import org.eclipse.persistence.internal.queries.MappedKeyMapContainerPolicy;
23
import org.eclipse.persistence.mappings.CollectionMapping;
26
import org.eclipse.persistence.mappings.CollectionMapping;
27
import org.eclipse.persistence.mappings.DatabaseMapping;
28
import org.eclipse.persistence.mappings.foundation.MapKeyMapping;
24
29
25
/**
30
/**
26
 * <p>
31
 * <p>
Lines 50-63 Link Here
50
        super(managedType, mapping);
55
        super(managedType, mapping);
51
56
52
        MapContainerPolicy policy = (MapContainerPolicy) mapping.getContainerPolicy();
57
        MapContainerPolicy policy = (MapContainerPolicy) mapping.getContainerPolicy();
53
        Object policyKeyType = policy.getKeyType(); // both cases return a Class<?>
58
        Object policyKeyType = policy.getKeyType(); // returns a Class<?> or descriptor (via AggregateObjectMapping)        
59
        Type<?> aKeyType = null;
60
        // Default to Object class for any variant cases that are not handled
61
        Class<?> javaClass = Object.class;
54
        if(null == policyKeyType) {
62
        if(null == policyKeyType) {
55
            // no key type, use Object  - test case required
63
            // No policy key type = IdClass (use CMP3Policy.pkClass)
56
            this.keyType = getMetamodel().getType((Class<K>)Object.class);
64
            if(managedType.isIdentifiableType()) {
57
        } else {
65
                // Use the CMPPolicy on the element not the one on the managedType
58
            Type<?> keyType = managedType.getMetamodel().getType((Class)policyKeyType);
66
                if(policy.getElementDescriptor() != null && policy.getElementDescriptor().getCMPPolicy() != null) {
59
            this.keyType = (Type<K>) keyType;
67
                    javaClass = policy.getElementDescriptor().getCMPPolicy().getPKClass();
68
                } else {
69
                    if(null == policy.getElementDescriptor()) {
70
                        // check for a keyMapping on the mapping
71
                        if(policy.isMappedKeyMapPolicy()) {
72
                            MapKeyMapping mapKeyMapping = ((MappedKeyMapContainerPolicy)policy).getKeyMapping();
73
                            RelationalDescriptor descriptor = (RelationalDescriptor)((DatabaseMapping)mapKeyMapping).getDescriptor();
74
                            // If the reference descriptor is null then we are on a direct mapping
75
                            if(null == descriptor) {
76
                                throw new IllegalArgumentException("Unsupported operation on " + managedType);
77
                            } else {
78
                                if(null == descriptor.getCMPPolicy()) { // for __PK_METAMODEL_RESERVED_IN_MEM_ONLY_FIELD_NAME
79
                                    //throw new IllegalArgumentException("Unsupported operation on " + managedType);
80
                                    javaClass = Object.class;
81
                                } else {
82
                                    javaClass = descriptor.getCMPPolicy().getPKClass();        
83
                                }
84
                            }
85
                        }
86
                    } else {                        
87
                    }
88
                }
89
            } else {
90
                // Handle EmbeddableType
91
            }
92
        } else {            
93
            if(policyKeyType instanceof ClassDescriptor) { // from AggregateObjectMapping
94
                javaClass = (Class<?>)((ClassDescriptor)policyKeyType).getJavaClass();
95
            } else {
96
                javaClass = (Class<?>)policyKeyType;
97
            }            
60
        }
98
        }
99
        aKeyType = getMetamodel().getType(javaClass);
100
        this.keyType = (Type<K>) aKeyType;
61
    }
101
    }
62
102
63
    /**
103
    /**
(-)jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metamodel/PluralAttributeImpl.java (-3 / +3 lines)
Lines 59-76 Link Here
59
        ClassDescriptor elementDesc = mapping.getContainerPolicy().getElementDescriptor();
59
        ClassDescriptor elementDesc = mapping.getContainerPolicy().getElementDescriptor();
60
60
61
        if (elementDesc != null) {
61
        if (elementDesc != null) {
62
            this.elementType = (Type<V>)managedType.getMetamodel().getType(elementDesc.getJavaClass());
62
            this.elementType = (Type<V>)getMetamodel().getType(elementDesc.getJavaClass());
63
        } else {
63
        } else {
64
            // TODO: BasicCollection (DirectCollectionMapping)
64
            // TODO: BasicCollection (DirectCollectionMapping)
65
            // See CollectionContainerPolicy
65
            // See CollectionContainerPolicy
66
            if(mapping.isDirectCollectionMapping() || mapping.isAbstractCompositeDirectCollectionMapping()) {// || mapping.isAbstractDirectMapping() ) {
66
            if(mapping.isDirectCollectionMapping() || mapping.isAbstractCompositeDirectCollectionMapping()) {// || mapping.isAbstractDirectMapping() ) {
67
                //CollectionContainerPolicy policy = (CollectionContainerPolicy) mapping.getContainerPolicy();
67
                //CollectionContainerPolicy policy = (CollectionContainerPolicy) mapping.getContainerPolicy();
68
                //this.elementType = managedType.getMetamodel().getType(policy.getElementDescriptor().getJavaClass());
68
                //this.elementType = getMetamodel().getType(policy.getElementDescriptor().getJavaClass());
69
            }
69
            }
70
            // TODO: Handle DirectMapContainerPolicy
70
            // TODO: Handle DirectMapContainerPolicy
71
            if(mapping.isMapKeyMapping()) {
71
            if(mapping.isMapKeyMapping()) {
72
                MapContainerPolicy policy = (MapContainerPolicy) mapping.getContainerPolicy();
72
                MapContainerPolicy policy = (MapContainerPolicy) mapping.getContainerPolicy();
73
                this.elementType = (Type<V>)managedType.getMetamodel().getType(policy.getElementClass());
73
                this.elementType = (Type<V>)getMetamodel().getType(policy.getElementClass());
74
            }
74
            }
75
        }
75
        }
76
    }
76
    }
(-)jpa/org.eclipse.persistence.jpa/src/org/eclipse/persistence/internal/jpa/metamodel/SingularAttributeImpl.java (-3 / +3 lines)
Lines 55-69 Link Here
55
            // EntityType
55
            // EntityType
56
            // We support @OneToOne but not EIS, Reference or VariableOneToOne
56
            // We support @OneToOne but not EIS, Reference or VariableOneToOne
57
            if(mapping.isOneToOneMapping()) {
57
            if(mapping.isOneToOneMapping()) {
58
                elementType = (Type<T>)managedType.getMetamodel().getType(
58
                elementType = (Type<T>)getMetamodel().getType(
59
                        ((OneToOneMapping)mapping).getReferenceClass());
59
                        ((OneToOneMapping)mapping).getReferenceClass());
60
            } else {
60
            } else {
61
                // TODO: default to containing class
61
                // TODO: default to containing class
62
                elementType = (Type<T>)managedType.getMetamodel().getType(managedType.getJavaType()); 
62
                elementType = (Type<T>)getMetamodel().getType(managedType.getJavaType()); 
63
            }
63
            }
64
        } else {
64
        } else {
65
            // BasicType
65
            // BasicType
66
            elementType = (Type<T>)managedType.getMetamodel().getType(attributeClassification);
66
            elementType = (Type<T>)getMetamodel().getType(attributeClassification);
67
        }
67
        }
68
    }
68
    }
69
69

Return to bug 266912