Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 211374 Details for
Bug 325162
[Validation] Embeddable class contained within an element collection must not a contain an element collection
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
propossed_patch_325162_5.txt (text/plain), 32.96 KB, created by
Leslie Davis
on 2012-02-21 17:08:05 EST
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Leslie Davis
Created:
2012-02-21 17:08:05 EST
Size:
32.96 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jpt.jpa.core >Index: property_files/jpa_validation.properties >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation.properties,v >retrieving revision 1.16 >diff -u -r1.16 jpa_validation.properties >--- property_files/jpa_validation.properties 9 Feb 2012 19:24:24 -0000 1.16 >+++ property_files/jpa_validation.properties 21 Feb 2012 22:01:07 -0000 >@@ -91,6 +91,8 @@ > ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST=Target class \"{0}\" does not exist > ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE=Target class \"{0}\" is not an embeddable or basic type > ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED=Target class is not defined >+ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING=Mapping contains an embeddable \"{0}\" with a prohibited mapping \"{1}\", element collections may not contain embeddables with element collection mappings >+ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING=Mapping contains an embeddable \"{0}\" with a prohibited mapping \"{1}\", embeddables in element collections may only contain many-to-one or one-to-one mappings which must be on the \"owning\" side of the relationship and must not use join table > EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED=Embedded IDs that are mapped by a relationship should not specify any attribute overrides. > ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED=In {0}, a column is specified, but it is mapped by a relationship. IDs that are mapped by a relationship should not specify a column. > MAPS_ID_VALUE_INVALID=In {0}, the "maps ID" value ''{1}'' does not refer to an attribute that is used as an ID for this entity >@@ -117,6 +119,8 @@ > TARGET_ENTITY_NOT_EXIST=Target entity \"{0}\" does not exist > VIRTUAL_ATTRIBUTE_MAP_KEY_CLASS_NOT_DEFINED=In implied attribute \"{0}\", map key class is not defined > VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST="In implied attribute \"{0}\", target class does not exist on the classpath" >+VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING=In implied attribute \"{0}"\, mapping contains an embeddable \"{1}\" with a prohibited mapping \"{2}\", element collections may not contain embeddables with element collection mappings >+VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING=In implied attribute \"{0}"\, mapping contains an embeddable \"{1}\" with a prohibited mapping \"{2}\", embeddables in element collections may only contain many-to-one or one-to-one mappings which must be on the \"owning\" side of the relationship and not use a join table > VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE=In implied attribute \"{0}\", target class \"{1}\" is not an embeddable or basic type > VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED=In implied attribute \"{0}\", target class is not defined > VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY=In implied attribute \"{0}\", target entity \"{1}\" is not an Entity >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java,v >retrieving revision 1.22 >diff -u -r1.22 AbstractJavaElementCollectionMapping2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java 16 Feb 2012 16:54:02 -0000 1.22 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java 21 Feb 2012 22:01:07 -0000 >@@ -20,6 +20,7 @@ > import org.eclipse.jpt.common.core.utility.TextRange; > import org.eclipse.jpt.common.utility.Filter; > import org.eclipse.jpt.common.utility.internal.Association; >+import org.eclipse.jpt.common.utility.internal.CollectionTools; > import org.eclipse.jpt.common.utility.internal.SimpleAssociation; > import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.common.utility.internal.Tools; >@@ -34,11 +35,13 @@ > import org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper; > import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; > import org.eclipse.jpt.jpa.core.JpaFactory; >+import org.eclipse.jpt.jpa.core.MappingKeys; > import org.eclipse.jpt.jpa.core.context.AssociationOverride; > import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; > import org.eclipse.jpt.jpa.core.context.AttributeMapping; > import org.eclipse.jpt.jpa.core.context.AttributeOverride; > import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; >+import org.eclipse.jpt.jpa.core.context.BaseEmbeddedMapping; > import org.eclipse.jpt.jpa.core.context.Column; > import org.eclipse.jpt.jpa.core.context.Converter; > import org.eclipse.jpt.jpa.core.context.Embeddable; >@@ -56,6 +59,7 @@ > import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride; > import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; > import org.eclipse.jpt.jpa.core.context.Relationship; >+import org.eclipse.jpt.jpa.core.context.RelationshipMapping; > import org.eclipse.jpt.jpa.core.context.Table; > import org.eclipse.jpt.jpa.core.context.TypeMapping; > import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; >@@ -96,7 +100,9 @@ > import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; > import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; >+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneRelationship2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; >+import org.eclipse.jpt.jpa.core.jpa2.context.OneToOneRelationship2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAssociationOverrideContainer2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaAttributeOverrideContainer2_0; >@@ -1474,6 +1480,131 @@ > this.collectionTable.validate(messages, reporter, astRoot); > this.validateValue(messages, reporter, astRoot); > this.validateMapKey(messages, reporter, astRoot); >+ this.validateNoEmbeddableInMappingContainsProhibittedMapping(messages, astRoot); >+ } >+ >+ protected void validateNoEmbeddableInMappingContainsProhibittedMapping(List<IMessage> messages, CompilationUnit astRoot) { >+ Embeddable embeddableClass = getResolvedTargetEmbeddable(); >+ if (embeddableClass != null) { >+ embeddableContainsElementCollection(messages, astRoot, embeddableClass); >+ embeddableContainsProhibitedRelationshipMapping(messages, astRoot, embeddableClass); >+ embeddableHierarchyContainsProhibittedMapping(messages, astRoot, embeddableClass, new ArrayList<Embeddable>()); >+ } >+ embeddableClass = getResolvedMapKeyEmbeddable(); >+ if (embeddableClass != null) { >+ embeddableContainsElementCollection(messages, astRoot, embeddableClass); >+ embeddableContainsProhibitedRelationshipMapping(messages, astRoot, embeddableClass); >+ embeddableHierarchyContainsProhibittedMapping(messages, astRoot, embeddableClass, new ArrayList<Embeddable>()); >+ } >+ } >+ >+ private void embeddableHierarchyContainsProhibittedMapping(List<IMessage> messages, CompilationUnit astRoot, Embeddable parentEmbeddable, List<Embeddable> visited) { >+ Iterable<AttributeMapping> embeddedIterable = parentEmbeddable.getAllAttributeMappings(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); >+ for(AttributeMapping mapping : embeddedIterable) { >+ Embeddable embeddable = ((BaseEmbeddedMapping)mapping).getTargetEmbeddable(); >+ if (embeddable != null && embeddable != parentEmbeddable) { >+ embeddableContainsElementCollection(messages, astRoot, embeddable); >+ embeddableContainsProhibitedRelationshipMapping(messages, astRoot, embeddable); >+ if (!CollectionTools.contains(visited, embeddable)) { >+ visited.add(embeddable); >+ embeddableHierarchyContainsProhibittedMapping(messages, astRoot, embeddable, visited); >+ } >+ } >+ } >+ Iterable<AttributeMapping> embeddedIdIterable = parentEmbeddable.getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); >+ for(AttributeMapping mapping : embeddedIdIterable) { >+ Embeddable embeddable = ((BaseEmbeddedMapping)mapping).getTargetEmbeddable(); >+ if (embeddable != null && embeddable != parentEmbeddable) { >+ embeddableContainsElementCollection(messages, astRoot, embeddable); >+ embeddableContainsProhibitedRelationshipMapping(messages, astRoot, embeddable); >+ if (!CollectionTools.contains(visited, embeddable)) { >+ visited.add(embeddable); >+ embeddableHierarchyContainsProhibittedMapping(messages, astRoot, embeddable, visited); >+ } >+ } >+ } >+ } >+ >+ private void embeddableContainsProhibitedRelationshipMapping(List<IMessage> messages, CompilationUnit astRoot, Embeddable embeddable) { >+ boolean prohibitedMappingFound = false; >+ RelationshipMapping relationshipMapping = null; >+ Iterable<AttributeMapping> manyToManyMappings = embeddable.getAllAttributeMappings(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); >+ Iterable<AttributeMapping> oneToManyMappings = embeddable.getAllAttributeMappings(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); >+ if (oneToManyMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)oneToManyMappings.iterator().next(); >+ prohibitedMappingFound = true; >+ } >+ if (manyToManyMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)manyToManyMappings.iterator().next(); >+ prohibitedMappingFound = true; >+ } >+ Iterable<AttributeMapping> manyToOneMappings = embeddable.getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); >+ if (manyToOneMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)manyToOneMappings.iterator().next(); >+ if (((RelationshipMapping)manyToOneMappings.iterator().next()).getRelationshipOwner() != null >+ || ((ManyToOneRelationship2_0)relationshipMapping.getRelationship()).getJoinTableStrategy().getJoinTable() != null) { >+ prohibitedMappingFound = true; >+ } >+ } >+ Iterable<AttributeMapping> oneToOneMappings = embeddable.getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); >+ if (oneToOneMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)oneToOneMappings.iterator().next(); >+ if (relationshipMapping.getRelationshipOwner() != null >+ || ((OneToOneRelationship2_0)relationshipMapping.getRelationship()).getJoinTableStrategy().getJoinTable() != null) { >+ prohibitedMappingFound = true; >+ } >+ } >+ if (prohibitedMappingFound) { >+ if (getPersistentAttribute().isVirtual()) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING, >+ new String[] {this.getName(), >+ embeddable.getName(), relationshipMapping.getName()}, >+ this, >+ this.getValidationTextRange(astRoot) >+ ) >+ ); >+ } else { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING, >+ new String[] {embeddable.getName(), relationshipMapping.getName()}, >+ this, >+ this.getValidationTextRange(astRoot) >+ ) >+ ); >+ } >+ } >+ } >+ >+ private void embeddableContainsElementCollection(List<IMessage> messages, CompilationUnit astRoot, Embeddable embeddable) { >+ Iterable<AttributeMapping> elementCollectionMappings = embeddable.getAllAttributeMappings(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY); >+ if (elementCollectionMappings.iterator().hasNext()) { >+ if (getPersistentAttribute().isVirtual()) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING, >+ new String[] {this.getName(), embeddable.getName(), elementCollectionMappings.iterator().next().getName()}, >+ this, >+ this.getValidationTextRange(astRoot) >+ ) >+ ); >+ } else { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING, >+ new String[] {embeddable.getName(), elementCollectionMappings.iterator().next().getName()}, >+ this, >+ this.getValidationTextRange(astRoot) >+ ) >+ ); >+ } >+ } > } > > protected void validateTargetClass(List<IMessage> messages, CompilationUnit astRoot) { >Index: src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java,v >retrieving revision 1.22 >diff -u -r1.22 AbstractOrmElementCollectionMapping2_0.java >--- src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java 16 Feb 2012 16:54:02 -0000 1.22 >+++ src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java 21 Feb 2012 22:01:08 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.jdt.core.IType; > import org.eclipse.jpt.common.core.internal.utility.JDTTools; > import org.eclipse.jpt.common.core.utility.TextRange; >+import org.eclipse.jpt.common.utility.internal.CollectionTools; > import org.eclipse.jpt.common.utility.internal.StringTools; > import org.eclipse.jpt.common.utility.internal.Tools; > import org.eclipse.jpt.common.utility.internal.Transformer; >@@ -28,11 +29,13 @@ > import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; > import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; > import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; >+import org.eclipse.jpt.jpa.core.MappingKeys; > import org.eclipse.jpt.jpa.core.context.AssociationOverride; > import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; > import org.eclipse.jpt.jpa.core.context.AttributeMapping; > import org.eclipse.jpt.jpa.core.context.AttributeOverride; > import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; >+import org.eclipse.jpt.jpa.core.context.BaseEmbeddedMapping; > import org.eclipse.jpt.jpa.core.context.Column; > import org.eclipse.jpt.jpa.core.context.Converter; > import org.eclipse.jpt.jpa.core.context.Embeddable; >@@ -50,6 +53,7 @@ > import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride; > import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; > import org.eclipse.jpt.jpa.core.context.Relationship; >+import org.eclipse.jpt.jpa.core.context.RelationshipMapping; > import org.eclipse.jpt.jpa.core.context.Table; > import org.eclipse.jpt.jpa.core.context.TypeMapping; > import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; >@@ -93,7 +97,9 @@ > import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; > import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; >+import org.eclipse.jpt.jpa.core.jpa2.context.ManyToOneRelationship2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; >+import org.eclipse.jpt.jpa.core.jpa2.context.OneToOneRelationship2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0; > import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0; >@@ -1472,9 +1478,109 @@ > this.collectionTable.validate(messages, reporter); > this.validateValue(messages, reporter); > this.validateMapKey(messages, reporter); >+ this.validateNoEmbeddableInMappingContainsProhibittedMapping(messages); > } > >- protected void validateTargetClass(List<IMessage> messages) { >+ protected void validateNoEmbeddableInMappingContainsProhibittedMapping(List<IMessage> messages) { >+ Embeddable embeddableClass = getResolvedTargetEmbeddable(); >+ if (embeddableClass != null) { >+ embeddableContainsElementCollection(messages, embeddableClass); >+ embeddableContainsProhibitedRelationshipMapping(messages, embeddableClass); >+ embeddableHierarchyContainsProhibittedMapping(messages, embeddableClass, new ArrayList<Embeddable>()); >+ } >+ embeddableClass = getResolvedMapKeyEmbeddable(); >+ if (embeddableClass != null) { >+ embeddableContainsElementCollection(messages, embeddableClass); >+ embeddableContainsProhibitedRelationshipMapping(messages, embeddableClass); >+ embeddableHierarchyContainsProhibittedMapping(messages, embeddableClass, new ArrayList<Embeddable>()); >+ } >+ } >+ >+ private void embeddableHierarchyContainsProhibittedMapping(List<IMessage> messages, Embeddable parentEmbeddable, List<Embeddable> visited) { >+ Iterable<AttributeMapping> embeddedIterable = parentEmbeddable.getAllAttributeMappings(MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY); >+ for(AttributeMapping mapping : embeddedIterable) { >+ Embeddable embeddable = ((BaseEmbeddedMapping)mapping).getTargetEmbeddable(); >+ if (embeddable != null && embeddable != parentEmbeddable) { >+ embeddableContainsElementCollection(messages, embeddable); >+ embeddableContainsProhibitedRelationshipMapping(messages, embeddable); >+ if (!CollectionTools.contains(visited, embeddable)) { >+ visited.add(embeddable); >+ embeddableHierarchyContainsProhibittedMapping(messages, embeddable, visited); >+ } >+ } >+ } >+ Iterable<AttributeMapping> embeddedIdIterable = parentEmbeddable.getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY); >+ for(AttributeMapping mapping : embeddedIdIterable) { >+ Embeddable embeddable = ((BaseEmbeddedMapping)mapping).getTargetEmbeddable(); >+ if (embeddable != null && embeddable != parentEmbeddable) { >+ embeddableContainsElementCollection(messages, embeddable); >+ embeddableContainsProhibitedRelationshipMapping(messages, embeddable); >+ if (!CollectionTools.contains(visited, embeddable)) { >+ visited.add(embeddable); >+ embeddableHierarchyContainsProhibittedMapping(messages, embeddable, visited); >+ } >+ } >+ } >+ } >+ >+ private void embeddableContainsProhibitedRelationshipMapping(List<IMessage> messages, Embeddable embeddable) { >+ boolean prohibitedMappingFound = false; >+ RelationshipMapping relationshipMapping = null; >+ Iterable<AttributeMapping> manyToManyMappings = embeddable.getAllAttributeMappings(MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY); >+ Iterable<AttributeMapping> oneToManyMappings = embeddable.getAllAttributeMappings(MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY); >+ if (oneToManyMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)oneToManyMappings.iterator().next(); >+ prohibitedMappingFound = true; >+ } >+ if (manyToManyMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)manyToManyMappings.iterator().next(); >+ prohibitedMappingFound = true; >+ } >+ Iterable<AttributeMapping> manyToOneMappings = embeddable.getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY); >+ if (manyToOneMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)manyToOneMappings.iterator().next(); >+ if (((RelationshipMapping)manyToOneMappings.iterator().next()).getRelationshipOwner() != null >+ ||((ManyToOneRelationship2_0)relationshipMapping.getRelationship()).getJoinTableStrategy().getJoinTable() != null) { >+ prohibitedMappingFound = true; >+ } >+ } >+ Iterable<AttributeMapping> oneToOneMappings = embeddable.getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY); >+ if (oneToOneMappings.iterator().hasNext()) { >+ relationshipMapping = (RelationshipMapping)oneToOneMappings.iterator().next(); >+ if (((RelationshipMapping)oneToOneMappings.iterator().next()).getRelationshipOwner() != null >+ || ((OneToOneRelationship2_0)relationshipMapping.getRelationship()).getJoinTableStrategy().getJoinTable() != null) { >+ prohibitedMappingFound = true; >+ } >+ } >+ if (prohibitedMappingFound) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING, >+ new String[] {embeddable.getName(), relationshipMapping.getName()}, >+ this, >+ this.getValidationTextRange() >+ ) >+ ); >+ } >+ } >+ >+ private void embeddableContainsElementCollection(List<IMessage> messages, Embeddable embeddable) { >+ Iterable<AttributeMapping> elementCollectionMappings = embeddable.getAllAttributeMappings(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY); >+ if (elementCollectionMappings.iterator().hasNext()) { >+ messages.add( >+ DefaultJpaValidationMessages.buildMessage( >+ IMessage.HIGH_SEVERITY, >+ JpaValidationMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING, >+ new String[] {embeddable.getName(), elementCollectionMappings.iterator().next().getName()}, >+ this, >+ this.getValidationTextRange() >+ ) >+ ); >+ } >+ } >+ >+ protected void validateTargetClass(List<IMessage> messages) { > if (StringTools.stringIsEmpty(this.getTargetClass())) { > messages.add( > DefaultJpaValidationMessages.buildMessage( >Index: src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java,v >retrieving revision 1.14 >diff -u -r1.14 JpaValidationMessages.java >--- src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java 5 Jan 2012 20:38:22 -0000 1.14 >+++ src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java 21 Feb 2012 22:01:08 -0000 >@@ -93,6 +93,8 @@ > public static final String MAP_KEY_CLASS_NOT_DEFINED = "MAP_KEY_CLASS_NOT_DEFINED"; > public static final String MAP_KEY_CLASS_NOT_EXIST = "MAP_KEY_CLASS_NOT_EXIST"; > public static final String ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST = "ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST"; >+ public static final String ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING = "ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING"; >+ public static final String ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING = "ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING"; > public static final String ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE = "ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE"; > public static final String ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED"; > public static final String EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED = "EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED"; >@@ -123,6 +125,8 @@ > //***Implied Attribute*** > public static final String VIRTUAL_ATTRIBUTE_MAP_KEY_CLASS_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_MAP_KEY_CLASS_NOT_DEFINED"; > public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST"; >+ public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING"; >+ public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING"; > public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE"; > public static final String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED = "VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED"; > public static final String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY = "VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY"; >#P org.eclipse.jpt.jpa.ui >Index: property_files/jpt_ui_validation_preferences.properties >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_validation_preferences.properties,v >retrieving revision 1.10 >diff -u -r1.10 jpt_ui_validation_preferences.properties >--- property_files/jpt_ui_validation_preferences.properties 5 Jan 2012 20:38:20 -0000 1.10 >+++ property_files/jpt_ui_validation_preferences.properties 21 Feb 2012 22:01:10 -0000 >@@ -88,6 +88,8 @@ > ATTRIBUTE_LEVEL_CATEGORY=Attribute > > ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST=Element collection target class does not exist on the project classpath: >+ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING=Element collection mapping contains an embeddable which contains a prohibited element collection mapping: >+ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING=Element collection mapping contains an embeddable which contains a prohibited relationship mapping: > ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE=Element collection target class is not embeddable or basic type: > ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED=Element collection target class is not specified: > EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED=Embedded IDs that are mapped by a relationship should not specify any attribute overrides: >@@ -118,6 +120,8 @@ > MAP_KEY_CLASS_NOT_EXIST=Map key class does not exist on the project classpath: > > VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST=Element collection target class does not exist on the project classpath: >+VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING=Element collection mapping contains an embeddable which contains a prohibited element collection mapping: >+VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING=Element collection mapping contains an embeddable which contains a prohibited relationship mapping: > VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE=Element collection target class is not embeddable or basic type: > VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED=Element collection target class is not specified: > VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY=Target entity is not an Entity: >Index: src/org/eclipse/jpt/jpa/ui/internal/JptUiValidationPreferenceMessages.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiValidationPreferenceMessages.java,v >retrieving revision 1.10 >diff -u -r1.10 JptUiValidationPreferenceMessages.java >--- src/org/eclipse/jpt/jpa/ui/internal/JptUiValidationPreferenceMessages.java 5 Jan 2012 20:38:20 -0000 1.10 >+++ src/org/eclipse/jpt/jpa/ui/internal/JptUiValidationPreferenceMessages.java 21 Feb 2012 22:01:10 -0000 >@@ -97,6 +97,8 @@ > public static String ATTRIBUTE_LEVEL_CATEGORY; > > public static String ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST;// 3.0 M7 >+ public static String ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING; >+ public static String ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING; > public static String ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE; > public static String ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED; > public static String EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED; //3.0 M7 >@@ -127,6 +129,8 @@ > public static String MAP_KEY_CLASS_NOT_EXIST; > // ---------- Implied Attributes ------------ > public static String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST; >+ public static String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING; >+ public static String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING; > public static String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE; > public static String VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED; > public static String VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY; >Index: src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java >=================================================================== >RCS file: /cvsroot/webtools/org.eclipse.jpa/components/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java,v >retrieving revision 1.13 >diff -u -r1.13 JpaProblemSeveritiesPage.java >--- src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java 20 Feb 2012 19:30:23 -0000 1.13 >+++ src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java 21 Feb 2012 22:01:10 -0000 >@@ -368,6 +368,8 @@ > addLabeledCombo(parent, JptUiValidationPreferenceMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE, JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE); > addLabeledCombo(parent, JptUiValidationPreferenceMessages.ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST, JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST); //3.0 M7 > addLabeledCombo(parent, JptUiValidationPreferenceMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED, JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED); >+ addLabeledCombo(parent, JptUiValidationPreferenceMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING, JpaValidationMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING); >+ addLabeledCombo(parent, JptUiValidationPreferenceMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING, JpaValidationMessages.ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING); > addLabeledCombo(parent, JptUiValidationPreferenceMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED, JpaValidationMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED); //3.0 M7 > addLabeledCombo(parent, JptUiValidationPreferenceMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED, JpaValidationMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED); //3.0 M7 > addLabeledCombo(parent, JptUiValidationPreferenceMessages.MAPS_ID_VALUE_INVALID, JpaValidationMessages.MAPS_ID_VALUE_INVALID); >@@ -397,6 +399,8 @@ > parent = addSubExpandableSection(parent, JptUiValidationPreferenceMessages.IMPLIED_ATTRIBUTE_LEVEL_CATEGORY); > > addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST, JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_DOES_NOT_EXIST); >+ addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING, JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_ELEMENT_COLLECTION_MAPPING); >+ addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING, JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_CONTAINS_EMBEDDABLE_WITH_PROHIBITED_RELATIONSHIP_MAPPING); > addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE, JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE); > addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED, JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED); > addLabeledCombo(parent, JptUiValidationPreferenceMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY, JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
neil.hauge
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 325162
:
190194
|
190850
|
190910
|
191033
|
211360
| 211374