From 240a1a1ce268a8b39ce330ea7f9e04ac01aba436 Mon Sep 17 00:00:00 2001 From: erik Date: Sun, 4 Apr 2010 11:43:21 +0000 Subject: [PATCH] --- .../toplink/ToplinkJpaCustomizer.java | 30 +++++++++++++++++++ .../persistence/toplink/ToplinkTables.java | 20 +++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java create mode 100644 trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java diff --git a/trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java b/trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java new file mode 100644 index 00000000..5ba15e84 --- /dev/null +++ b/trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java @@ -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 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/trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java b/trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java new file mode 100644 index 00000000..cd3a0562 --- /dev/null +++ b/trunk/support/test/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java @@ -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 TABLES = Arrays.asList(new String[] { "SEQUENCE" } ); + + public boolean accept(String aTableName) throws DataSetException { + return TABLES.contains(aTableName); + } + +} -- 2.31.1