summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Butzke2012-11-16 07:01:13 (EST)
committerKaren Butzke2012-11-16 07:01:13 (EST)
commit7cfcd24e88317897df16c5a581592db4a54ebb20 (patch)
treeef6cad824d2400dfeddf07b6b3bbcf79a3f9a449
parentbd394a91909bc10d33eeb5ddcbf41feb9763c364 (diff)
downloadwebtools.dali-7cfcd24e88317897df16c5a581592db4a54ebb20.zip
webtools.dali-7cfcd24e88317897df16c5a581592db4a54ebb20.tar.gz
webtools.dali-7cfcd24e88317897df16c5a581592db4a54ebb20.tar.bz2
Bug 389934 - Regression - Changing a Java attribute type such that the attribute should be unmapped does not work
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
index 4241b52..6bd9a9f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java
@@ -403,8 +403,10 @@ public abstract class AbstractJavaPersistentAttribute
JavaAttributeMappingDefinition defaultDefinition = this.getDefaultMappingDefinition();
String newDefaultKey = (defaultDefinition == null) ? null : defaultDefinition.getKey();
+ boolean mappingChanged = false;
if (ObjectTools.notEquals(this.mapping.getKey(), newDefaultKey)) {
newDefinition = defaultDefinition; // the default mapping has changed - hold on to the definition
+ mappingChanged = true;
}
this.setDefaultMappingKey(newDefaultKey);
@@ -412,19 +414,21 @@ public abstract class AbstractJavaPersistentAttribute
String newSpecifiedKey = (specifiedDefinition == null) ? null : specifiedDefinition.getKey();
if (specifiedDefinition != null) {
newDefinition = null; // unset definition if it was set from default calculation
+ mappingChanged = false;
if (this.mapping.isDefault() || ObjectTools.notEquals(this.mapping.getKey(), newSpecifiedKey)) {
newDefinition = specifiedDefinition; // mapping is now specified or a different specified
+ mappingChanged = true;
}
}
- if (newDefinition != null) {
- setMapping(buildMapping(newDefinition));
+ if (mappingChanged) {
+ this.setMapping(this.buildMapping(newDefinition));
}
else {
this.mapping.update();
}
}
-
+
protected JavaAttributeMappingDefinition getDefaultMappingDefinition() {
for (DefaultJavaAttributeMappingDefinition definition : this.getDefaultMappingDefinitions()) {
if (definition.isDefault(this)) {