diff options
author | kmoore | 2012-02-21 16:52:36 +0000 |
---|---|---|
committer | kmoore | 2012-02-21 16:52:36 +0000 |
commit | 66fdfc8b9abc02c01d6a00a9dff9dd990209adca (patch) | |
tree | 97a55822ac4862cd9ea4cba979f409009c79cde8 /jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa | |
parent | 63e7702dcce487fc75c1fcaa73571a004d364bb0 (diff) | |
download | webtools.dali-66fdfc8b9abc02c01d6a00a9dff9dd990209adca.tar.gz webtools.dali-66fdfc8b9abc02c01d6a00a9dff9dd990209adca.tar.xz webtools.dali-66fdfc8b9abc02c01d6a00a9dff9dd990209adca.zip |
cleaned up targetEmbeddable so that it works more like targetEntity
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa')
5 files changed, 11 insertions, 19 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java index 94310eb2e1..3afdf461f6 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java @@ -14,7 +14,6 @@ import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute; import org.eclipse.jpt.common.core.resource.java.JavaResourceField; import org.eclipse.jpt.common.core.resource.java.JavaResourceMethod; import org.eclipse.jpt.jpa.core.context.CollectionMapping; -import org.eclipse.jpt.jpa.core.context.Embeddable; import org.eclipse.jpt.jpa.core.context.PersistentAttribute; import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; @@ -70,11 +69,6 @@ public interface JavaPersistentAttribute */ boolean contains(int offset, CompilationUnit astRoot); - /** - * Return the embeddable (type mapping) corresponding to the persistent - * attribute's type. Return <code>null</code> if it is not found. - */ - Embeddable getEmbeddable(); // ********** type ********** diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java index 185a031659..8dca259ddc 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. + * Copyright (c) 2007, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -109,7 +109,8 @@ public abstract class AbstractJavaBaseEmbeddedMapping<A extends Annotation> } protected Embeddable buildTargetEmbeddable() { - return this.getPersistentAttribute().getEmbeddable(); + String typeName = this.getPersistentAttribute().getSingleReferenceTargetTypeName(); + return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName); } 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 a0815940ad..3da6183bbc 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 @@ -27,7 +27,6 @@ import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; import org.eclipse.jpt.jpa.core.JpaStructureNode; import org.eclipse.jpt.jpa.core.context.AccessType; import org.eclipse.jpt.jpa.core.context.CollectionMapping; -import org.eclipse.jpt.jpa.core.context.Embeddable; import org.eclipse.jpt.jpa.core.context.PersistentType; import org.eclipse.jpt.jpa.core.context.TypeMapping; import org.eclipse.jpt.jpa.core.context.java.Accessor; @@ -600,11 +599,6 @@ public abstract class AbstractJavaPersistentAttribute return (fullTextRange == null) ? false : fullTextRange.includes(offset); } - public Embeddable getEmbeddable() { - String typeName = this.getTypeName(); - return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName); - } - @Override public void toString(StringBuilder sb) { sb.append(this.getName()); diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java index 5d4a57193a..fef316ec16 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. + * Copyright (c) 2006, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -67,7 +67,9 @@ public class JavaEmbeddedMappingDefinition } public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getEmbeddable() != null; + String targetEmbeddable = persistentAttribute.getSingleReferenceTargetTypeName(); + return (targetEmbeddable != null) + && (persistentAttribute.getPersistenceUnit().getEmbeddable(targetEmbeddable) != null); } @Override diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java index ab6482db29..44781ee036 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. + * Copyright (c) 2007, 2012 Oracle. All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0, which accompanies this distribution * and is available at http://www.eclipse.org/legal/epl-v10.html. @@ -108,8 +108,9 @@ public abstract class AbstractOrmBaseEmbeddedMapping<X extends AbstractXmlEmbedd } protected Embeddable buildTargetEmbeddable() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getEmbeddable(); + JavaPersistentAttribute javaPersistentAttribute = getJavaPersistentAttribute(); + String typeName = (javaPersistentAttribute == null) ? null : javaPersistentAttribute.getSingleReferenceTargetTypeName(); + return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName); } |