Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/HibernateTest.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/HibernateTest.java b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/HibernateTest.java
index 25df8717ac..635ccd134b 100644
--- a/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/HibernateTest.java
+++ b/plugins/org.eclipse.emf.cdo.tests/src/org/eclipse/emf/cdo/tests/HibernateTest.java
@@ -34,7 +34,12 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.MySQLDialect;
+import java.io.PrintWriter;
+import java.sql.Driver;
+import java.sql.DriverManager;
import java.util.HashMap;
import java.util.Map;
@@ -45,7 +50,7 @@ public class HibernateTest
{
private static final String REPOSITORY_NAME = "repo1";
- public static void main(String[] args)
+ public static void main(String[] args) throws Exception
{
// Turn on tracing
OMPlatform.INSTANCE.setDebugging(true);
@@ -77,7 +82,7 @@ public class HibernateTest
connector.disconnect();
}
- private static IRepository createRepository()
+ private static IRepository createRepository() throws Exception
{
Map<String, String> props = new HashMap<String, String>();
props.put(Props.PROP_SUPPORTING_AUDITS, "false");
@@ -88,9 +93,20 @@ public class HibernateTest
return CDOServerUtil.createRepository(REPOSITORY_NAME, createStore(), props);
}
- private static IStore createStore()
+ private static IStore createStore() throws Exception
{
+ DriverManager.setLogWriter(new PrintWriter(System.out));
+ Driver driver = new com.mysql.jdbc.Driver();
+ DriverManager.registerDriver(driver);
+ String driverName = driver.getClass().getName();
+ String dialectName = MySQLDialect.class.getName();
+
Configuration configuration = new Configuration();
+ configuration.setProperty(Environment.DRIVER, driverName);
+ configuration.setProperty(Environment.URL, "jdbc:mysql://localhost/cdohibernate");
+ configuration.setProperty(Environment.USER, "root");
+ configuration.setProperty(Environment.DIALECT, dialectName);
+ configuration.setProperty(Environment.SHOW_SQL, "true");
return new HibernateStore(configuration);
}

Back to the top