-1

我在使用 Talend Open Studio for Data Integration 构建数据迁移作业时遇到问题。Talend open studio 生成 java 类。我从一个mysql表迁移到另一个。

该声明:

    String insert_tMysqlOutput_1 = "INSERT INTO `"
                    + "workitem"
                    + "` (`name`,`type`,`budgetHours`,`deadline`,`dateStart`,`dateEnd`,`dateCreated`,`projectId`,`parentWorkItem`,`description`,`dateUpdated`,`companyId`,`state`,`reporterId`,`assigneeId`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; 

            java.sql.PreparedStatement pstmt_tMysqlOutput_1 = conn_tMysqlOutput_1
                    .prepareStatement(insert_tMysqlOutput_1);

错误:

Exception in component tMysqlOutput_1 com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dashboard.work_item' doesn't exist
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:409)
at com.mysql.jdbc.Util.getInstance(Util.java:384)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1054)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3566)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3498)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2568)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2113)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2409)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2327)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2312)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.tMysqlInput_1Process(Copy_of_workitem.java:3677)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.tMysqlConnection_2Process(Copy_of_workitem.java:1109)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.runJobInTOS(Copy_of_workitem.java:7370)
at dashboard_new.copy_of_workitem_2_0.Copy_of_workitem.main(Copy_of_workitem.java:7069)

表结构(编辑#1)

CREATE TABLE  `dashboard`.`workitem` (
`workItemId` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`type` varchar(255) NOT NULL,
`projectId` bigint(20) NOT NULL DEFAULT '0',
`companyId` bigint(20) DEFAULT NULL,
`budgetHours` decimal(10,0) DEFAULT NULL,
`deadline` datetime DEFAULT NULL,
`dateStart` datetime DEFAULT NULL,
`dateEnd` datetime DEFAULT NULL,
`parentWorkItem` bigint(20) DEFAULT NULL,
`description` text,
`state` varchar(45) DEFAULT NULL,
`reporterId` bigint(20) DEFAULT NULL,
`assigneeId` bigint(20) DEFAULT NULL,
`dateCreated` datetime DEFAULT NULL,
`dateUpdated` datetime DEFAULT NULL,
`newColumn` varchar(10) DEFAULT NULL,
PRIMARY KEY (`workItemId`),
KEY `fk_project_id_idx` (`projectId`),
KEY `fk_parent_work_item_idx` (`parentWorkItem`),
KEY `fk_workitem_company1_idx` (`companyId`),
KEY `fk_workitem_name` (`name`),
KEY `fk_workitem_assignee` (`assigneeId`),
KEY `fk_workitem_reporter` (`reporterId`),
CONSTRAINT `fk_workitem_company1` FOREIGN KEY (`companyId`) REFERENCES `company`    (`companyId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2461 DEFAULT CHARSET=latin1

奇怪的是..work_item在代码中找不到..所以我认为必须对语句进行一些缓存但不知道在哪里..

编辑#1:当我将一个字段添加到表中不存在的查询中时,我得到一个错误字段未找到..所以以某种方式检查这些字段是否存在。

有没有人有任何想法?

谢谢

4

1 回答 1

0

有东西正在访问work_item,但表的名称是workitem

Perhaps there is a trigger on the table that has a coding error in it.
Or perhaps you have not posted the latest versions.

于 2012-12-27T12:25:47.213 回答