Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2007-06-13 12:24:30 -0400
committerkmoore2007-06-13 12:24:30 -0400
commit70297119eb6d20a04968d4f822cffbaa6e498b3a (patch)
tree4f2f9d39d98b11aebc8901925b72e7613fd052bc
parentace2c847be3fb3da91531ca2955695f860c46955 (diff)
downloadwebtools.dali-70297119eb6d20a04968d4f822cffbaa6e498b3a.tar.gz
webtools.dali-70297119eb6d20a04968d4f822cffbaa6e498b3a.tar.xz
webtools.dali-70297119eb6d20a04968d4f822cffbaa6e498b3a.zip
192287 - patch applied - validation error for non-owning side of bidirectional 1-1 mapping
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java9
6 files changed, 36 insertions, 2 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java
index 9b6876d9bd..828ecaee82 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaManyToOneContext.java
@@ -21,4 +21,10 @@ public class JavaManyToOneContext extends JavaSingleRelationshipMappingContext
public void addToMessages(List<IMessage> messages) {
super.addToMessages(messages);
}
+
+ //ManyToOne mapping is always the owning side
+ protected boolean isOwningSide() {
+ return true;
+ }
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java
index 29330a802b..ab3a6c2674 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaOneToOneContext.java
@@ -86,4 +86,9 @@ public class JavaOneToOneContext extends JavaSingleRelationshipMappingContext
);
}
}
+
+ @Override
+ protected boolean isOwningSide() {
+ return getMapping().getMappedBy() == null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java
index ba852c1a90..a9526299ee 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaSingleRelationshipMappingContext.java
@@ -88,11 +88,17 @@ public abstract class JavaSingleRelationshipMappingContext
public void addToMessages(List<IMessage> messages) {
super.addToMessages(messages);
- if (entityOwned()) {
+ //bug 192287 - do not want joinColumn validation errors on the non-owning side
+ //of a bidirectional relationship. This is a low risk fix for RC3, but a better
+ //solution would be to not have the default joinColumns on the non-owning side.
+ //This would fix another bug that we show default joinColumns in this situation.
+ if (entityOwned() && isOwningSide()) {
addJoinColumnMessages(messages);
}
}
+ protected abstract boolean isOwningSide();
+
protected void addJoinColumnMessages(List<IMessage> messages) {
ISingleRelationshipMapping mapping = getMapping();
ITypeMapping typeMapping = mapping.typeMapping();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java
index 5d3f00015b..9f1bdf6b7a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlManyToOneContext.java
@@ -16,4 +16,9 @@ public class XmlManyToOneContext
public XmlManyToOneContext(IContext parentContext, XmlManyToOne mapping) {
super(parentContext, mapping);
}
+
+ //ManyToOne mapping is always the owning side
+ protected boolean isOwningSide() {
+ return true;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java
index 33e786ec51..ebd501b23f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlOneToOneContext.java
@@ -88,4 +88,9 @@ public class XmlOneToOneContext
);
}
}
+
+ @Override
+ protected boolean isOwningSide() {
+ return getMapping().getMappedBy() == null;
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java
index afa28c5e39..3976246d77 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlSingleRelationshipMappingContext.java
@@ -66,11 +66,18 @@ public abstract class XmlSingleRelationshipMappingContext
public void addToMessages(List<IMessage> messages) {
super.addToMessages(messages);
- if (entityOwned()) {
+ //bug 192287 - do not want joinColumn validation errors on the non-owning side
+ //of a bidirectional relationship. This is a low risk fix for RC3, but a better
+ //solution would be to not have the default joinColumns on the non-owning side.
+ //This would fix another bug that we show default joinColumns in this situation.
+ if (entityOwned() && isOwningSide()) {
addJoinColumnMessages(messages);
}
}
+ protected abstract boolean isOwningSide();
+
+
protected void addJoinColumnMessages(List<IMessage> messages) {
XmlSingleRelationshipMapping mapping = singleRelationshipMapping();
ITypeMapping typeMapping = mapping.typeMapping();

Back to the top