|
Lines 19-25
Link Here
|
| 19 |
* keep workaround for bug# 294765 for Basic keyType when MapKey annotation not specified. |
19 |
* keep workaround for bug# 294765 for Basic keyType when MapKey annotation not specified. |
| 20 |
* keep workaround for bug# 294811 for Entity, Embeddable, Transient keyType support |
20 |
* keep workaround for bug# 294811 for Entity, Embeddable, Transient keyType support |
| 21 |
* when MapKey name attribute not specified (MapContainerPolicy) |
21 |
* when MapKey name attribute not specified (MapContainerPolicy) |
| 22 |
* add BasicMap support via DirectMapContainerPolicy |
22 |
* add BasicMap support via DirectMapContainerPolicy |
|
|
23 |
* 13/10/2009-2.0 mobrien - 294765 - fix allows removal of workaround for |
| 24 |
* when MapKey annotation not specified |
| 23 |
******************************************************************************/ |
25 |
******************************************************************************/ |
| 24 |
package org.eclipse.persistence.internal.jpa.metamodel; |
26 |
package org.eclipse.persistence.internal.jpa.metamodel; |
| 25 |
|
27 |
|
|
Lines 150-166
Link Here
|
| 150 |
// The cast below is unavoidable because getKeyMapping() is not overridden from the MapContainerPolicy superclass |
152 |
// The cast below is unavoidable because getKeyMapping() is not overridden from the MapContainerPolicy superclass |
| 151 |
keyMapping = ((MappedKeyMapContainerPolicy)policy).getKeyMapping(); |
153 |
keyMapping = ((MappedKeyMapContainerPolicy)policy).getKeyMapping(); |
| 152 |
policyKeyType = keyMapping.getMapKeyTargetType(); |
154 |
policyKeyType = keyMapping.getMapKeyTargetType(); |
| 153 |
/** |
|
|
| 154 |
* If the policyKeyType is not found - it is because the keyMapping is a Basic (DirectToFieldMapping implements MapKeyMapping). |
| 155 |
* Normally we get the pk type via the referenceClass on a OneToOneMapping for example. |
| 156 |
* However, in this case MappedKeyMapContainerPolicy.keyMapping.attributeAccessor.attributeField is null - |
| 157 |
* we workaround this by getting the key from the attributeClassification instead. |
| 158 |
* See UC1a, UC7 |
| 159 |
*/ |
| 160 |
if(null == policyKeyType) { |
| 161 |
// This workaround for bug# 294765 should be moved up into AbstractDirectMapping.getMapKeyTargetType |
| 162 |
policyKeyType = ((DatabaseMapping)keyMapping).getAttributeClassification(); |
| 163 |
} |
| 164 |
} else { |
155 |
} else { |
| 165 |
/** |
156 |
/** |
| 166 |
* Assume we have a MapContainerPolicy general superclass with a lazy-loaded keyType |
157 |
* Assume we have a MapContainerPolicy general superclass with a lazy-loaded keyType |
|
Lines 187-193
Link Here
|
| 187 |
// Use the PK of the element - not the one on the managedType |
178 |
// Use the PK of the element - not the one on the managedType |
| 188 |
// Case: @MapKey private Map<K,V> // no name column specified |
179 |
// Case: @MapKey private Map<K,V> // no name column specified |
| 189 |
if(policyElementDescriptor != null && policyElementDescriptor.getCMPPolicy() != null) { |
180 |
if(policyElementDescriptor != null && policyElementDescriptor.getCMPPolicy() != null) { |
| 190 |
// See UC9, UC10, UC12(embeddable), UC13 |
181 |
// See UC10, UC12(embeddable), UC13 |
| 191 |
// This workaround for bug# 294811 should be moved up into the MapKeyMapping.getMapKeyTargetType() interface method |
182 |
// This workaround for bug# 294811 should be moved up into the MapKeyMapping.getMapKeyTargetType() interface method |
| 192 |
javaClass = policy.getElementDescriptor().getCMPPolicy().getPKClass(); |
183 |
javaClass = policy.getElementDescriptor().getCMPPolicy().getPKClass(); |
| 193 |
} |
184 |
} |