Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2011-12-14 11:01:22 +0000
committerMartin Taal2011-12-14 11:01:22 +0000
commitcf81567abe1be8ec6cbdaeec15788a9c322d2278 (patch)
tree25ec51098b9738c23d2ac2969b3b215e7f152d7a /plugins
parent148b326f48e26222c35ba94a23f2105f096b0a2f (diff)
downloadcdo-cf81567abe1be8ec6cbdaeec15788a9c322d2278.tar.gz
cdo-cf81567abe1be8ec6cbdaeec15788a9c322d2278.tar.xz
cdo-cf81567abe1be8ec6cbdaeec15788a9c322d2278.zip
Fixes issue [366594] - CDO with hibernate cannot be used standalone due to NPE in HibernateUtil.createMappingProviderFactory
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/CDOHibernateUtil.java18
-rw-r--r--plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/internal/hibernate/HibernateUtil.java19
3 files changed, 37 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
index 4cb8a659a8..f13c208ce9 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.emf.cdo.server.hibernate;singleton:=true
-Bundle-Version: 4.0.100.qualifier
+Bundle-Version: 4.1.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/CDOHibernateUtil.java b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/CDOHibernateUtil.java
index 73fc3368f7..f1504adb4a 100644
--- a/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/CDOHibernateUtil.java
+++ b/plugins/org.eclipse.emf.cdo.server.hibernate/src/org/eclipse/emf/cdo/server/hibernate/CDOHibernateUtil.java
@@ -12,6 +12,7 @@
package org.eclipse.emf.cdo.server.hibernate;
import org.eclipse.emf.cdo.server.internal.hibernate.HibernateStore;
+import org.eclipse.emf.cdo.server.internal.hibernate.HibernateUtil;
/**
* @author Eike Stepper
@@ -23,6 +24,23 @@ public final class CDOHibernateUtil
{
}
+ /**
+ * @since 4.1
+ */
+ public static IHibernateMappingProvider.Factory getMappingProviderFactoryInstance()
+ {
+ return HibernateUtil.getMappingProviderFactoryInstance();
+ }
+
+ /**
+ * @since 4.1
+ */
+ public static void setMappingProviderFactoryInstance(
+ IHibernateMappingProvider.Factory theMappingProviderFactoryInstance)
+ {
+ HibernateUtil.setMappingProviderFactoryInstance(theMappingProviderFactoryInstance);
+ }
+
public static IHibernateStore createStore(IHibernateMappingProvider mappingProvider)
{
return new HibernateStore(mappingProvider);
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 7685a882f7..1798bc6eb2 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