[Seasar-user:17511] Re: dbfluteのgenerateタスクにてIllegalStateException
kubo
[E-MAIL ADDRESS DELETED]
2009年 5月 25日 (月) 17:59:19 JST
久保です。
内田さん、こんにちは
テーブル名に「group」という名前が使われていますが、
「group」はSQLにおける予約語です。(group byとか)
DBFluteだけでなく、SQLを書く際に何かと不便なため、
別の名前にすることをお奨めします。
2009/5/25 ECS内田 <[E-MAIL ADDRESS DELETED]>:
> 内田と申します。
>
> dbflute-0.9.4.1を使用しております。
> 以下の2テーブルを用意し、
> generateタスクを実行したところ
> IllegalStateExceptionが発生してしまいます。
>
> テーブル設計に問題があるのでしょうか。。。
>
> 何か解決の手立てはございますでしょうか?
> よろしくお願いいたします。
>
>
> CREATE TABLE `sample1`.`group` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `name` text CHARACTER SET latin1 NOT NULL,
> PRIMARY KEY (`id`)
> ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
>
> CREATE TABLE `sample1`.`users` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `user_name` varchar(255) CHARACTER SET latin1 NOT NULL,
> `passwd` varchar(255) CHARACTER SET latin1 NOT NULL,
> `group_id` int(10) unsigned NOT NULL,
> PRIMARY KEY (`id`),
> KEY `FK_users_1` (`group_id`),
> CONSTRAINT `FK_users_1` FOREIGN KEY (`group_id`) REFERENCES `group` (`id`)
> ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
>
>
> dbflute.logの抜粋--------------------------------------------
>
> Failed to execute DBFlute Task 'JDBC'!
>
> [Basic Properties]
> database = mysql
> language = java
> container = seasar
>
> [Database Properties]
> driver = com.mysql.jdbc.Driver
> url = jdbc:mysql://localhost:3306/sample1
> schema =
> user = root
>
> [Runtime Exception]
> exception class = class java.lang.IllegalStateException
> * * * * * * * * * */
> java.lang.IllegalStateException: The handling for AutoIncrement threw the SQLException: primaryKeyColumnName=id tableMetaInfo=group(TABLE): ignoredMessage=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 'group where 1 = 0' at line 1
> at org.seasar.dbflute.helper.jdbc.metadata.DfAutoIncrementHandler.isAutoIncrementColumn(DfAutoIncrementHandler.java:76)
> at org.apache.torque.task.TorqueJDBCTransformTask.isAutoIncrementColumn(TorqueJDBCTransformTask.java:728)
> at org.apache.torque.task.TorqueJDBCTransformTask.generateXML(TorqueJDBCTransformTask.java:334)
> at org.apache.torque.task.TorqueJDBCTransformTask.doExecute(TorqueJDBCTransformTask.java:184)
> at org.seasar.dbflute.task.bs.DfAbstractTask.execute(DfAbstractTask.java:83)
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
> at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
> at org.apache.tools.ant.Task.perform(Task.java:348)
> at org.apache.tools.ant.Target.execute(Target.java:357)
> at org.apache.tools.ant.Target.performTasks(Target.java:385)
> at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
> at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
> at org.apache.tools.ant.Main.runBuild(Main.java:698)
> at org.apache.tools.ant.Main.startAnt(Main.java:199)
> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
> Caused by: com.mysql.jdbc.exceptions.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 'group where 1 = 0' at line 1
> at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
> at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
> at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
> at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
> at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
> at com.mysql.jdbc.Statement.executeQuery(Statement.java:1169)
> at org.seasar.dbflute.helper.jdbc.metadata.DfAutoIncrementHandler.isAutoIncrementColumn(DfAutoIncrementHandler.java:49)
> ... 20 more
> 2009-05-25 15:56:59,828 [main] INFO (DfAbstractTask#execute():130) -
>
>
> _______________________________________________
> Seasar-user mailing list
> [E-MAIL ADDRESS DELETED]
> https://ml.seasar.org/mailman/listinfo/seasar-user
>
Seasar-user メーリングリストの案内