EntityManager em = null;
try {
em = entityManagerFactory.createEntityManager();
Connection conn = getConnection(em);
assert null != conn;
IDatabaseConnection dbunitConn = new DatabaseConnection(conn);
// only if we are running against HSQL
String dbProdName = conn.getMetaData().getDatabaseProductName();
if (dbProdName.toLowerCase().contains("hsql")) {
DatabaseConfig config = dbunitConn.getConfig();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
new HsqlDataTypeFactory());
}
IDataSet dataSet = loadDataSet(dbunitConn);
databaseTester = new DefaultDatabaseTester(dbunitConn);