Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2012-02-02 16:35:08 +0000
committerkmoore2012-02-02 16:35:08 +0000
commit830e68343f2a983859f376cbcac8bab17f8aa764 (patch)
tree54953a67a60f656b2bcfe4a5bbba2752ec2b9781 /jpa/plugins/org.eclipse.jpt.jpa.core/src
parent3df915a8b6354262d293bb78e6f095d170f52a2a (diff)
downloadwebtools.dali-830e68343f2a983859f376cbcac8bab17f8aa764.tar.gz
webtools.dali-830e68343f2a983859f376cbcac8bab17f8aa764.tar.xz
webtools.dali-830e68343f2a983859f376cbcac8bab17f8aa764.zip
Bug 277017 - class chooser widgets don't work if package is set in orm.xml
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.core/src')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java15
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java26
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java10
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java10
21 files changed, 166 insertions, 26 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java
index 8d63b18cb5..679d23184a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Oracle. All rights reserved.
+ * Copyright (c) 2010, 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.
@@ -9,6 +9,7 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
/**
@@ -20,7 +21,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.2
* @since 2.3
*/
public interface IdClassReference
@@ -88,4 +89,11 @@ public interface IdClassReference
* @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
*/
char getIdClassEnclosingTypeSeparator();
+
+ /**
+ * Return the {@link IType} that is resolved from the id class name
+ * or null if none exists.
+ */
+ IType getIdClassJdtType();
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java
index beba80ec44..3967375755 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 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.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
+import org.eclipse.jdt.core.IType;
+
/**
* named native query
* <p>
@@ -18,7 +20,7 @@ package org.eclipse.jpt.jpa.core.context;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.2
+ * @version 3.2
* @since 2.0
*/
public interface NamedNativeQuery
@@ -37,6 +39,12 @@ public interface NamedNativeQuery
*/
char getResultClassEnclosingTypeSeparator();
+ /**
+ * Return the {@link IType} that is resolved from the result class name
+ * or null if none exists.
+ */
+ IType getResultClassJdtType();
+
// ********** result set mapping **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
index 16cf97465b..0fc8782e84 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.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.
@@ -9,6 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.jpa.core.context;
+import org.eclipse.jdt.core.IType;
+
/**
* JPA relationship (1:1, 1:m, m:1, m:m) mapping.
* <p>
@@ -18,7 +20,7 @@ package org.eclipse.jpt.jpa.core.context;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.2
* @since 2.0
*/
public interface RelationshipMapping
@@ -61,7 +63,14 @@ public interface RelationshipMapping
* @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char)
*/
char getTargetEntityEnclosingTypeSeparator();
-
+
+ /**
+ * Return the {@link IType} that is resolved from the target entity name
+ * or null if none exists.
+ */
+ IType getTargetEntityJdtType();
+
+
// **************** cascade **************************************
Cascade getCascade();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
index 3c8ddfa1b5..4581afdc3c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.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.
@@ -21,7 +21,7 @@ import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.1
+ * @version 3.2
* @since 2.0
*/
public interface JavaNamedNativeQuery
@@ -29,4 +29,11 @@ public interface JavaNamedNativeQuery
{
NamedNativeQueryAnnotation getQueryAnnotation();
+ /**
+ * If the result class is specified, this will return it fully qualified. If not
+ * specified, then it will return null
+ */
+ String getFullyQualifiedResultClass();
+ String FULLY_QUALIFIED_RESULT_CLASS_PROPERTY = "fullyQualifiedResultClass"; //$NON-NLS-1$
+
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java
index ea81dae761..96973f42f0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 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.
@@ -29,7 +29,7 @@ import org.eclipse.text.edits.ReplaceEdit;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 3.0
+ * @version 3.2
* @since 2.0
*/
public interface OrmTypeMapping
@@ -51,6 +51,12 @@ public interface OrmTypeMapping
void setClass(String class_);
String CLASS_PROPERTY = "class"; //$NON-NLS-1$
+ /**
+ * Return the {@link IType} that is resolved from the class name
+ * or null if none exists.
+ */
+ IType getJdtType();
+
// ********** metadata complete **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
index 533fcfd97a..c9b6422427 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.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.
@@ -18,6 +18,7 @@ import java.util.Vector;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jpt.common.core.internal.utility.jdt.JDTModifiedDeclaration.Adapter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
@@ -122,6 +123,10 @@ public abstract class AbstractJpaNode
// ********** convenience methods **********
+ protected IJavaProject getJavaProject() {
+ return this.getJpaProject().getJavaProject();
+ }
+
protected JpaPlatform getJpaPlatform() {
return this.getJpaProject().getJpaPlatform();
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
index 237ab0e0d8..aedda37c2d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java
@@ -363,6 +363,7 @@ public abstract class AbstractJpaProject
return this.project;
}
+ @Override
public IJavaProject getJavaProject() {
return JavaCore.create(this.project);
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
index 48f19fed46..e2a20ac95b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.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.
@@ -11,7 +11,9 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.resource.java.Annotation;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAttribute;
import org.eclipse.jpt.common.core.resource.java.NestableAnnotation;
@@ -466,6 +468,9 @@ public abstract class AbstractJavaMultiRelationshipMapping<A extends Relationshi
return this.getPersistenceUnit().getEntity(this.fullyQualifiedMapKeyClass);
}
+ public IType getMapKeyClassJdtType() {
+ return JDTTools.findType(this.getJavaProject(), this.fullyQualifiedMapKeyClass);
+ }
// ********** map key class annotation **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
index c5d376a0bc..99ea35a51f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.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.
@@ -11,6 +11,7 @@ package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
@@ -145,12 +146,16 @@ public abstract class AbstractJavaRelationshipMapping<A extends RelationshipMapp
}
public Entity getResolvedTargetEntity() {
- return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetEntity);
+ return this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetEntity);
}
// sub-classes like this to be public
public PersistentType getResolvedTargetType() {
- return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetEntity);
+ return this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetEntity);
+ }
+
+ public IType getTargetEntityJdtType() {
+ return JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedTargetEntity());
}
public char getTargetEntityEnclosingTypeSeparator() {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
index ae12ff6f56..8e6351628b 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.internal.context.java;
import java.util.List;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.resource.java.JavaResourceAnnotatedElement.Kind;
@@ -101,6 +102,10 @@ public class GenericJavaIdClassReference
return this.idClassName != null;
}
+ public IType getIdClassJdtType() {
+ return JDTTools.findType(this.getJavaProject(), this.getFullyQualifiedIdClassName());
+ }
+
// ********** id class annotation **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
index 60b1bef194..1696747ce6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.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.
@@ -463,6 +463,10 @@ public abstract class AbstractOrmMultiRelationshipMapping<X extends AbstractXmlM
return this.resolvePersistentType(this.getMapKeyClass());
}
+ public IType getMapKeyClassJdtType() {
+ return this.getEntityMappings().resolveJdtType(this.getMapKeyClass());
+ }
+
// ********** value type **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
index 26bef62ea3..723458b340 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.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.
@@ -148,6 +148,10 @@ public abstract class AbstractOrmRelationshipMapping<X extends AbstractXmlRelati
return '$';
}
+ public IType getTargetEntityJdtType() {
+ return this.getEntityMappings().resolveJdtType(this.getTargetEntity());
+ }
+
// ********** relationship reference **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
index d5e06fe335..8ab857f12f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.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.
@@ -33,6 +33,7 @@ import org.eclipse.jpt.jpa.core.context.Relationship;
import org.eclipse.jpt.jpa.core.context.TypeMapping;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute;
import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping;
@@ -193,6 +194,14 @@ public abstract class AbstractOrmTypeMapping<X extends XmlTypeMapping>
return (javaType == null) ? null : javaType.getJavaResourceType();
}
+ public IType getJdtType() {
+ return getEntityMappings().resolveJdtType(this.getClass_());
+ }
+
+ protected EntityMappings getEntityMappings() {
+ return getPersistentType().getParent();
+ }
+
public boolean isMapped() {
return true;
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
index 5edfb02562..5c36fc9fcb 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java
@@ -136,6 +136,10 @@ public class GenericOrmIdClassReference
return this.getIdClassName() != null;
}
+ public IType getIdClassJdtType() {
+ return this.getEntityMappings().resolveJdtType(this.getIdClassName());
+ }
+
// ********** xml id class ref **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
index e4676d1071..aa556ba6f8 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentType.java
@@ -276,14 +276,14 @@ public abstract class SpecifiedOrmPersistentType
}
/**
- * Use {@link #getMappingClassName()} instead of {@link #getName()} to
+ * Use {@link OrmTypeMapping#getClass_()} instead of {@link #getName()} to
* look up the Java resource type because {@link #getName()}
* simply delegates to the existing Java resource persistent type. (In
* which case we wouldn't need to resolve it, would we?) [bug 339560]
* @see #updateJavaPersistentType()
*/
protected JavaResourceAbstractType resolveJavaResourceType() {
- return this.getEntityMappings().resolveJavaResourceType(this.getMappingClassName());
+ return this.getEntityMappings().resolveJavaResourceType(this.mapping.getClass_());
}
/**
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
index 767fe6741f..5300d48de9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java
@@ -10,7 +10,9 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.java;
import java.util.List;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.Query;
@@ -30,6 +32,7 @@ public class GenericJavaNamedNativeQuery
implements JavaNamedNativeQuery
{
protected String resultClass;
+ protected String fullyQualifiedResultClass;
protected String resultSetMapping;
@@ -50,6 +53,11 @@ public class GenericJavaNamedNativeQuery
this.setResultSetMapping_(this.queryAnnotation.getResultSetMapping());
}
+ @Override
+ public void update() {
+ super.update();
+ this.setFullyQualifiedResultClass(this.buildFullyQualifiedResultClass());
+ }
// ********** result class **********
@@ -68,10 +76,28 @@ public class GenericJavaNamedNativeQuery
this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass);
}
+ public String getFullyQualifiedResultClass() {
+ return this.fullyQualifiedResultClass;
+ }
+
+ protected void setFullyQualifiedResultClass(String resultClass) {
+ String old = this.fullyQualifiedResultClass;
+ this.fullyQualifiedResultClass = resultClass;
+ this.firePropertyChanged(FULLY_QUALIFIED_RESULT_CLASS_PROPERTY, old, resultClass);
+ }
+
+ protected String buildFullyQualifiedResultClass() {
+ return this.queryAnnotation.getFullyQualifiedResultClassName();
+ }
+
public char getResultClassEnclosingTypeSeparator() {
return '.';
}
+ public IType getResultClassJdtType() {
+ return JDTTools.findType(this.getJavaProject(), this.fullyQualifiedResultClass);
+ }
+
// ********** result set mapping **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
index 6cb46e01bc..59aa581935 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;
import java.util.List;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.context.NamedNativeQuery;
import org.eclipse.jpt.jpa.core.context.Query;
@@ -71,6 +72,10 @@ public class GenericOrmNamedNativeQuery
return '$';
}
+ public IType getResultClassJdtType() {
+ return this.getMappingFileRoot().resolveJdtType(this.getResultClass());
+ }
+
// ********** result set mapping **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
index 6de190b259..c2d6bdd561 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 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.
@@ -12,6 +12,7 @@ package org.eclipse.jpt.jpa.core.internal.jpa2.context.java;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.resource.java.Annotation;
@@ -339,6 +340,10 @@ public abstract class AbstractJavaElementCollectionMapping2_0
return this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetClass);
}
+ public IType getTargetClassJdtType() {
+ return JDTTools.findType(this.getJavaProject(), this.fullyQualifiedTargetClass);
+ }
+
// ********** fetch **********
@@ -900,6 +905,10 @@ public abstract class AbstractJavaElementCollectionMapping2_0
return this.getPersistenceUnit().getEntity(this.fullyQualifiedMapKeyClass);
}
+ public IType getMapKeyClassJdtType() {
+ return JDTTools.findType(this.getJavaProject(), this.fullyQualifiedMapKeyClass);
+ }
+
// ********** map key class annotation **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
index 393b212021..d0c154d360 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2009, 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.
@@ -316,6 +316,10 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping();
}
+ public IType getTargetClassJdtType() {
+ return this.getEntityMappings().resolveJdtType(this.getTargetClass());
+ }
+
// ********** fetch **********
@@ -854,6 +858,10 @@ public abstract class AbstractOrmElementCollectionMapping2_0<X extends XmlElemen
return this.resolvePersistentType(this.getMapKeyClass());
}
+ public IType getMapKeyClassJdtType() {
+ return this.getEntityMappings().resolveJdtType(this.getMapKeyClass());
+ }
+
// ********** map key column **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
index f22926f7a1..d9d8a66a63 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 Oracle. All rights reserved.
+ * Copyright (c) 2010, 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.
@@ -50,6 +50,12 @@ public interface CollectionMapping2_0
*/
char getMapKeyClassEnclosingTypeSeparator();
+ /**
+ * Return the {@link IType} that is resolved from the map key class name
+ * or null if none exists.
+ */
+ IType getMapKeyClassJdtType();
+
// ********** map key column **********
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
index 0ddfda7d8f..cf0f082cd0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 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.
@@ -25,7 +25,7 @@ import org.eclipse.jpt.jpa.core.context.Entity;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.2
* @since 2.3
*/
public interface ElementCollectionMapping2_0
@@ -57,6 +57,12 @@ public interface ElementCollectionMapping2_0
*/
char getTargetClassEnclosingTypeSeparator();
+ /**
+ * Return the {@link IType} that is resolved from the target class name
+ * or null if none exists.
+ */
+ IType getTargetClassJdtType();
+
// ********** collection table **********

Back to the top