diff options
author | kmoore | 2010-05-25 14:12:17 +0000 |
---|---|---|
committer | kmoore | 2010-05-25 14:12:17 +0000 |
commit | d4d0275fe0f983f789f3afc6f0737de82e20a302 (patch) | |
tree | 49091795dc8700cf3ce5439cbf3638b353e0034b /jpa/plugins | |
parent | 7abbdf2420e99a218a7165382c19b44265fa0be2 (diff) | |
download | webtools.dali-d4d0275fe0f983f789f3afc6f0737de82e20a302.tar.gz webtools.dali-d4d0275fe0f983f789f3afc6f0737de82e20a302.tar.xz webtools.dali-d4d0275fe0f983f789f3afc6f0737de82e20a302.zip |
313766 - StackOverflowError with a self-referential ElementCollection or Embedded
Diffstat (limited to 'jpa/plugins')
4 files changed, 18 insertions, 14 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java index e6277f943d..e50c6e21b5 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java @@ -104,12 +104,13 @@ public abstract class AbstractJavaBaseEmbeddedMapping<T extends Annotation> setTargetEmbeddable_(this.getPersistentAttribute().getEmbeddable()); this.attributeOverrideContainer.update(this.getResourcePersistentAttribute()); } - + protected Iterator<AttributeMapping> embeddableAttributeMappings() { - if (this.getTargetEmbeddable() == null) { - return EmptyIterator.instance(); + Embeddable targetEmbeddable = getTargetEmbeddable(); + if (targetEmbeddable != null && targetEmbeddable != getPersistentAttribute().getOwningTypeMapping()) { + return targetEmbeddable.attributeMappings(); } - return this.getTargetEmbeddable().attributeMappings(); + return EmptyIterator.instance(); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java index 2b7ca2f267..eb17fbafee 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java @@ -92,12 +92,13 @@ public abstract class AbstractOrmBaseEmbeddedMapping<T extends AbstractXmlEmbedd this.targetEmbeddable = newTargetEmbeddable; firePropertyChanged(TARGET_EMBEDDABLE_PROPERTY, oldTargetEmbeddable, newTargetEmbeddable); } - + protected Iterator<AttributeMapping> embeddableAttributeMappings() { - if (this.getTargetEmbeddable() == null) { - return EmptyIterator.instance(); + Embeddable targetEmbeddable = getTargetEmbeddable(); + if (targetEmbeddable != null && targetEmbeddable != getPersistentAttribute().getOwningTypeMapping()) { + return targetEmbeddable.attributeMappings(); } - return this.getTargetEmbeddable().attributeMappings(); + return EmptyIterator.instance(); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java index 927361d5b3..8736b45a3d 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java @@ -997,10 +997,11 @@ public abstract class AbstractJavaElementCollectionMapping2_0 } protected Iterator<AttributeMapping> embeddableAttributeMappings() { - if (this.getResolvedTargetEmbeddable() == null) { - return EmptyIterator.instance(); + Embeddable targetEmbeddable = getResolvedTargetEmbeddable(); + if (targetEmbeddable != null && targetEmbeddable != getPersistentAttribute().getOwningTypeMapping()) { + return targetEmbeddable.attributeMappings(); } - return this.getResolvedTargetEmbeddable().attributeMappings(); + return EmptyIterator.instance(); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java index bd9a4d5f4d..13ef480789 100644 --- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java +++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java @@ -665,10 +665,11 @@ public abstract class AbstractOrmElementCollectionMapping2_0<T extends XmlElemen } protected Iterator<AttributeMapping> embeddableAttributeMappings() { - if (this.getResolvedTargetEmbeddable() == null) { - return EmptyIterator.instance(); + Embeddable targetEmbeddable = getResolvedTargetEmbeddable(); + if (targetEmbeddable != null && targetEmbeddable != getPersistentAttribute().getOwningTypeMapping()) { + return targetEmbeddable.attributeMappings(); } - return this.getResolvedTargetEmbeddable().attributeMappings(); + return EmptyIterator.instance(); } @Override |