HHH-11635 - MySQLSkipAutoCommitTest fails when run on MariaDB

This commit is contained in:
Andrea Boriero 2017-04-14 14:47:07 +02:00
parent 3ba49e76b8
commit a630809857
1 changed files with 5 additions and 1 deletions

View File

@ -10,12 +10,13 @@ import javax.sql.DataSource;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Environment;
import org.hibernate.dialect.MariaDBDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.test.util.ReflectionUtil;
/**
* @author Vlad Mihalcea
*/
@ -25,6 +26,9 @@ public class MySQLSkipAutoCommitTest extends AbstractSkipAutoCommitTest {
@Override
protected DataSource dataSource() {
DataSource dataSource = ReflectionUtil.newInstance( "com.mysql.cj.jdbc.MysqlDataSource" );
if ( getDialect() instanceof MariaDBDialect ) {
dataSource = ReflectionUtil.newInstance( "org.mariadb.jdbc.MariaDbDataSource" );
}
ReflectionUtil.setProperty( dataSource, "url", Environment.getProperties().getProperty( AvailableSettings.URL ) );
ReflectionUtil.setProperty( dataSource, "user", Environment.getProperties().getProperty( AvailableSettings.USER ) );
ReflectionUtil.setProperty( dataSource, "password", Environment.getProperties().getProperty( AvailableSettings.PASS ) );