title: Java Prepared statement error table not found
body: <p>I've got a problem with a data migration job build with Talend Open Studio for Data Integration. Talend open studio generates java classes. Im migration from one mysql table to another. </p>
  
  <p>The statement:</p>
  
  <pre><code>    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);
  </code></pre>
  
  <p>The error: </p>
  
  <pre class="lang-none prettyprint-override"><code>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)
  </code></pre>
  
  <p>Table structure (EDIT #1)</p>
  
  <pre class="lang-sql prettyprint-override"><code>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
  </code></pre>
  
  <p>The strange thing is.. <code>work_item</code> is not found in the code.. so i think there must by some caching of the statement but have no idea where..</p>
  
  <p>EDIT #1:
  And when i add a field into the query that does not exist inside the table then i get an error field not found.. so somehow check if the fields do exists.</p>
  
  <p>Does anyone have any ideas?</p>
  
  <p>Thanks</p>