(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 4 Apr 2010 11:43:21 +0000 (11:43 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Sun, 4 Apr 2010 11:43:21 +0000 (11:43 +0000)
support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java [new file with mode: 0644]
support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java [new file with mode: 0644]

diff --git a/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java b/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java
new file mode 100644 (file)
index 0000000..5ba15e8
--- /dev/null
@@ -0,0 +1,30 @@
+package org.wamblee.support.persistence.toplink;
+
+import java.util.Map;
+
+import org.dbunit.dataset.filter.ITableFilterSimple;
+import org.wamblee.support.persistence.JpaCustomizer;
+import org.wamblee.support.persistence.PersistenceUnitDescription;
+
+public class ToplinkJpaCustomizer implements JpaCustomizer {
+
+    public ToplinkJpaCustomizer() { 
+        // Empty
+    }
+    
+    @Override
+    public void customize(PersistenceUnitDescription aPersistenceUnit, Map<String, String> aJpaProperties) {
+        // Hack to make JNDI lookup of the datasource work with toplink
+        aJpaProperties.put("toplink.session.customizer", JndiSessionCustomizer.class
+                .getName());
+        
+        // DDL generation for toplink
+        aJpaProperties.put("toplink.ddl-generation", "create-tables");   
+    }
+    
+    @Override
+    public ITableFilterSimple getJpaTables() {
+        return new ToplinkTables();
+    }
+
+}
diff --git a/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java b/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java
new file mode 100644 (file)
index 0000000..cd3a056
--- /dev/null
@@ -0,0 +1,20 @@
+package org.wamblee.support.persistence.toplink;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.dbunit.dataset.DataSetException;
+import org.dbunit.dataset.filter.ITableFilterSimple;
+
+/**
+ * Toplink-specific tables. 
+ */
+public class ToplinkTables implements ITableFilterSimple {
+
+       private static final List<String> TABLES = Arrays.asList(new String[] { "SEQUENCE" } );
+       
+       public boolean accept(String aTableName) throws DataSetException {
+               return TABLES.contains(aTableName);
+       }
+
+}