Как вы можете себе представить,MyBatis создать несколько таблиц для MySQL
CREATE TABLE table1(id int);
CREATE TABLE table2(id int);
легко выполнимый на MySQL и практически любой другой SQL-базы данных.
Этот
<update id="test">
CREATE TABLE table1(id int);
CREATE TABLE table2(id int);
</update>
исполняемым на MS SQL Server, но не на MySQL-базы данных. Ошибка:
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE table2(id int)' at line 2
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: CREATE TABLE table1(id int); CREATE TABLE table2(id int);
Любые идеи, почему это так?
EDIT:
<update id="test">
CREATE TABLE table(id int);
</update>
.. работает везде.
EDIT для уточнения: My full mybatis mapper.xml.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="InitializationMapper">
<update id="test">
CREATE TABLE table1(id int);
CREATE TABLE table2(id int);
</update>
</mapper>
Fine. Но каков ваш вопрос? – planetmaker
Отредактировано. Теперь прямо перед вопросительным знаком. ;) –
http://stackoverflow.com/questions/23000085/mybatis-migrations-migrate-up-causes-org-apache-ibatis-jdbc-runtimesqlexception 'Настройка send_full_script = false в файле enviornment.properties устраняет проблему. ' Может найти ваш ответ там – Nathan