Skip to content

Change to calling BaseDataTest#runScript on setup test data #1269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2018

Conversation

kazuki43zoo
Copy link
Member

@kazuki43zoo kazuki43zoo commented May 3, 2018

Before (e.x):

SqlSession session = sqlSessionFactory.openSession();
Connection conn = session.getConnection();
reader = Resources.getResourceAsReader("org/apache/ibatis/submitted/ancestor_ref/CreateDB.sql");
ScriptRunner runner = new ScriptRunner(conn);
runner.setLogWriter(null);
runner.runScript(reader);
conn.close();
reader.close();
session.close();

After:

BaseDataTest.runScript(sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(),
       "org/apache/ibatis/submitted/ancestor_ref/CreateDB.sql");

The BaseDataTest#runScript is more simply and safely.

@kazuki43zoo kazuki43zoo merged commit aab059d into mybatis:master May 3, 2018
@kazuki43zoo kazuki43zoo deleted the setup-test-data branch May 3, 2018 09:17
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Change to calling BaseDataTest#runScript on setup test data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant