Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authornhauge2012-05-25 01:19:05 +0000
committernhauge2012-05-25 01:19:05 +0000
commit168e78d7abf20c176402c8c7341b4eb4c2f75298 (patch)
tree7dfa8aacef001f77185eb2e5afc43f1717422d0b /jpa
parent794fd11cec8da4bb859c0c1e657e0bf2b600d451 (diff)
downloadwebtools.dali-168e78d7abf20c176402c8c7341b4eb4c2f75298.tar.gz
webtools.dali-168e78d7abf20c176402c8c7341b4eb4c2f75298.tar.xz
webtools.dali-168e78d7abf20c176402c8c7341b4eb4c2f75298.zip
380574 - Unregistered listener exceptions after deleting the implied mapping file. Patch from Karen.
Diffstat (limited to 'jpa')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java8
3 files changed, 16 insertions, 8 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
index 48715912f5..33c7fb9e9d 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java
@@ -149,6 +149,8 @@ public abstract class AbstractMappingFileRef
// content type changed, the JPA project would return null... ~bjv]
// [I have hit this before (had this println uncommmented),
// but I am not sure how... ~kfb]
+ // [I hit this by deleting the implied orm.xml file and then adding it back, I think
+ // it will not be possible to hit it now that I null out the mappingFile is dispose() ~kfb]
// System.out.println("AbstractMappingFileRef.syncMappingFile");
// if the resource's content type has changed, we completely rebuild the mapping file
this.mappingFile.dispose();
@@ -215,6 +217,8 @@ public abstract class AbstractMappingFileRef
public void dispose() {
if (this.mappingFile != null) {
this.mappingFile.dispose();
+ //need to null this because we are storing the "potential" mappingFileRef in the PersistenceUnit
+ this.mappingFile = null;
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
index 9b0d80c313..b6a38d1fe9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java
@@ -608,6 +608,10 @@ public abstract class AbstractPersistenceUnit
protected XmlMappingFileRef getResourceElement(MappingFileRef contextElement) {
return contextElement.getXmlMappingFileRef();
}
+ @Override
+ protected void disposeElement(MappingFileRef element) {
+ element.dispose();
+ }
}
@@ -634,12 +638,12 @@ public abstract class AbstractPersistenceUnit
protected void updateImpliedMappingFileRef() {
if (this.usesImpliedMappingFile()) {
this.setImpliedMappingFileRef(this.potentialImpliedMappingFileRef);
- this.potentialImpliedMappingFileRef.update();
+ this.impliedMappingFileRef.update();
}
- else {
+ else if (this.impliedMappingFileRef != null) {
+ //this is needed to unregister the root structure node
+ this.impliedMappingFileRef.dispose();
this.setImpliedMappingFileRef(null);
- //this is needed to unregister the root structure node, how we build the root structure nodes probably needs to change.
- this.potentialImpliedMappingFileRef.dispose();
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
index 66307043f2..17c1ce8e17 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceUnit.java
@@ -317,12 +317,12 @@ public class EclipseLinkPersistenceUnit
if (this.usesImpliedEclipseLinkMappingFile()) {
this.setImpliedEclipseLinkMappingFileRef(this.potentialImpliedEclipseLinkMappingFileRef);
- this.potentialImpliedEclipseLinkMappingFileRef.update();
+ this.impliedEclipseLinkMappingFileRef.update();
}
- else {
+ else if (this.impliedEclipseLinkMappingFileRef != null) {
+ //this is needed to unregister the root structure node
+ this.impliedEclipseLinkMappingFileRef.dispose();
this.setImpliedEclipseLinkMappingFileRef(null);
- //this is needed to unregister the root structure node, how we build the root structure nodes probably needs to change.
- this.potentialImpliedEclipseLinkMappingFileRef.dispose();
}
}

Back to the top