--- /dev/null
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.wamblee</groupId>
+ <artifactId>wamblee-utils</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.wamblee</groupId>
+ <artifactId>wamblee-support-test-hibernate</artifactId>
+ <packaging>jar</packaging>
+ <name>wamblee.org support general library</name>
+ <url>http://wamblee.org</url>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.wamblee</groupId>
+ <artifactId>wamblee-support-test-enterprise</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.wamblee</groupId>
+ <artifactId>wamblee-support-test-enterprise</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <type>test-jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.dbunit</groupId>
+ <artifactId>dbunit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.wamblee</groupId>
+ <artifactId>wamblee-hibernate-jpa</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
--- /dev/null
+package org.wamblee.support.persistence.hibernate;
+
+import java.util.Map;
+
+import org.dbunit.dataset.filter.ITableFilterSimple;
+import org.wamblee.support.persistence.JpaCustomizer;
+import org.wamblee.support.persistence.PersistenceUnitDescription;
+
+public class HibernateJpaCustomizer implements JpaCustomizer {
+
+ public HibernateJpaCustomizer() {
+ // Empty
+ }
+
+ @Override
+ public void customize(PersistenceUnitDescription aPersistenceUnit, Map<String, String> aJpaProperties) {
+ // Hibernate: Override transaction type and datasource
+ aJpaProperties.put("javax.persistence.transactionType", "RESOURCE_LOCAL");
+ aJpaProperties.put("javax.persistence.jtaDataSource", null);
+ aJpaProperties.put("javax.persistence.nonJtaDataSource", aPersistenceUnit.getJndiName());
+
+ // Hibernate schema generation
+ aJpaProperties.put("hibernate.hbm2ddl.auto", "create");
+ }
+
+ @Override
+ public ITableFilterSimple getJpaTables() {
+ return new HibernateTables();
+ }
+
+}
--- /dev/null
+package org.wamblee.support.persistence.hibernate;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.dbunit.dataset.DataSetException;
+import org.dbunit.dataset.filter.ITableFilterSimple;
+
+/**
+ * Toplink-specific tables.
+ */
+public class HibernateTables implements ITableFilterSimple {
+
+ private static final List<String> TABLES = Arrays.asList(new String[] { "" } );
+
+ public boolean accept(String aTableName) throws DataSetException {
+ return TABLES.contains(aTableName);
+ }
+
+}
-org.wamblee.support.persistence.toplink.ToplinkJpaCustomizer
org.wamblee.support.persistence.hibernate.HibernateJpaCustomizer
--- /dev/null
+package org.wamblee.support.persistence.hibernate;
+
+import static junit.framework.Assert.assertEquals;
+
+import javax.persistence.EntityManager;
+import javax.sql.DataSource;
+
+import org.dbunit.IDatabaseTester;
+import org.dbunit.dataset.ITable;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.wamblee.support.persistence.Database;
+import org.wamblee.support.persistence.DatabaseBuilder;
+import org.wamblee.support.persistence.DatabaseUtils;
+import org.wamblee.support.persistence.DatabaseUtilsTestBase;
+import org.wamblee.support.persistence.JpaBuilder;
+import org.wamblee.support.persistence.PersistenceUnitDescription;
+import org.wamblee.support.persistence.JpaBuilder.JpaUnitOfWork;
+
+public class DatabaseUtilsTest extends DatabaseUtilsTestBase {
+ // Empty, all tests inherited
+}
--- /dev/null
+package org.wamblee.support.persistence.hibernate;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Persistence;
+import javax.sql.DataSource;
+
+import org.dbunit.DataSourceDatabaseTester;
+import org.dbunit.DatabaseTestCase;
+import org.dbunit.IDatabaseTester;
+import org.dbunit.dataset.ITable;
+import org.dbunit.dataset.filter.ITableFilterSimple;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.wamblee.support.persistence.DatabaseUtils;
+import org.wamblee.support.persistence.JpaBuilder;
+import org.wamblee.support.persistence.JpaTester;
+import org.wamblee.support.persistence.MyEntityExampleTestBase;
+import org.wamblee.support.persistence.JpaBuilder.JpaUnitOfWork;
+
+import static junit.framework.Assert.*;
+
+
+/**
+ * This class shows an example of how to test an entity using jpa.
+ */
+public class MyEntityExampleTest extends MyEntityExampleTestBase {
+ // Empty, all tests are inherited
+}