Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2011-12-13 13:07:31 -0500
committerMartin Taal2011-12-13 13:07:31 -0500
commitdbd61677236871330cb1f64eb3b920b8809c8142 (patch)
treeb94bcc90f6001c55949dd693ca886797fe8b3e7e
parent8b8dceecc5acfde9415ad7f7cbabc183d4b269ba (diff)
downloadcdo-dbd61677236871330cb1f64eb3b920b8809c8142.tar.gz
cdo-dbd61677236871330cb1f64eb3b920b8809c8142.tar.xz
cdo-dbd61677236871330cb1f64eb3b920b8809c8142.zip
Fixes issue 366162 CDO with hibernate cannot be used standalone due to NPE in HibernateUtil.createMappingProviderFactory
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java1
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java19
2 files changed, 19 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
index 3f0a10b00d..ddea807f73 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateStoreAccessor.java
@@ -1032,6 +1032,7 @@ public class HibernateStoreAccessor extends StoreAccessor implements IHibernateS
{
clearThreadState();
}
+ getStore().getRepository().getRevisionManager().getCache().clear();
}
@Override
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
index d4cea45b53..0e2423d7e1 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java
@@ -79,6 +79,19 @@ public class HibernateUtil
private static final String CLASS = "class"; //$NON-NLS-1$
+ private static IHibernateMappingProvider.Factory mappingProviderFactoryInstance = null;
+
+ public static IHibernateMappingProvider.Factory getMappingProviderFactoryInstance()
+ {
+ return mappingProviderFactoryInstance;
+ }
+
+ public static void setMappingProviderFactoryInstance(
+ IHibernateMappingProvider.Factory theMappingProviderFactoryInstance)
+ {
+ mappingProviderFactoryInstance = theMappingProviderFactoryInstance;
+ }
+
/**
* @return the global singleton instance
*/
@@ -191,6 +204,10 @@ public class HibernateUtil
public IHibernateMappingProvider.Factory createMappingProviderFactory(String type)
{
IExtensionRegistry registry = Platform.getExtensionRegistry();
+ if (registry == null)
+ {
+ return getMappingProviderFactoryInstance();
+ }
IConfigurationElement[] elements = registry.getConfigurationElementsFor(OM.BUNDLE_ID, EXT_POINT);
for (final IConfigurationElement element : elements)
{
@@ -211,7 +228,7 @@ public class HibernateUtil
}
}
- return null;
+ return getMappingProviderFactoryInstance();
}
/**

Back to the top