Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java35
1 files changed, 26 insertions, 9 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
index 73fe4b3911..b67fe399af 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java
@@ -302,15 +302,28 @@ public abstract class AbstractJavaAttributeMapping<A extends Annotation>
protected void validateMappingType(List<IMessage> messages) {
if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) {
- messages.add(
- DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
- new String[] {this.getName()},
- this,
- this.getValidationTextRange()
- )
- );
+ if (this.getPersistentAttribute().isVirtual()) {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING, //TODO KFB - different message for virtual attribute
+ new String[] {this.getName()},
+ this,
+ this.getVirtualPersistentAttributeTextRange()
+ )
+ );
+ }
+ else {
+ messages.add(
+ DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING,
+ new String[] {this.getName()},
+ this,
+ this.getValidationTextRange()
+ )
+ );
+ }
}
}
@@ -319,6 +332,10 @@ public abstract class AbstractJavaAttributeMapping<A extends Annotation>
return (textRange != null) ? textRange : this.getPersistentAttribute().getValidationTextRange();
}
+ protected TextRange getVirtualPersistentAttributeTextRange() {
+ return this.getPersistentAttribute().getValidationTextRange();
+ }
+
protected TextRange getMappingAnnotationTextRange() {
A annotation = this.getMappingAnnotation();
return (annotation == null) ? null : annotation.getTextRange();

Back to the top