Ok, it seems that I wasn't following the example in the documentation closely enough for .onDuplicateKeyUpdate() - it appears to be working now (although not as speedily as I had hoped - need to play around a bit).
Sorry for bugging you again! Ian. On Thu, Apr 26, 2012 at 3:48 PM, Ian Clarke <[email protected]> wrote: > So it looks like it's not an issue with the batch stuff, even if I just do > i.execute() I get: > > org.jooq.exception.DataAccessException: AbstractQuery.execute; SQL > [insert into `report_aggregates` (`start_time`, `period_length`, > `ad_exchange`, `end_time`, `html_creative_id`, `audience`, `account_id`, > `destination_id`, `destination_group_id`, `impressions`, `clicks`, > `cookies`, `spend`) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) on > duplicate key update [ no fields are updated ]]; 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 '[ no fields are updated ]' at line 1 > Any ideas? > > Ian. > > On Thu, Apr 26, 2012 at 1:08 PM, Ian Clarke <[email protected]> wrote: > >> So here is my code: >> >> final List<InsertQuery<ReportAggregatesRecord>> batchInsert = >> Lists.newLinkedList(); >> while (...) { >> >> final >> InsertQuery<ReportAggregatesRecord> i = >> create.insertQuery(Tables.REPORT_AGGREGATES); >> >> i.addValue(..., ...); >> >> i.addValue(..., ...); >> >> ... >> >> i.onDuplicateKeyUpdate(true); >> >> batchInsert.add(i); >> >> } >> >> create.batch(batchInsert).execute(); >> >> And here is my exception (thrown by the last line): >> >> org.jooq.exception.DataAccessException: BatchMultiple.execute; SQL >> [null]; 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 >> '[ no fields are updated ]' at line 1 >> >> at org.jooq.impl.Util.translate(Util.java:472) ~[jooq-2.2.2.jar:na] >> >> at org.jooq.impl.BatchMultiple.execute(BatchMultiple.java:91) >> ~[jooq-2.2.2.jar:na] >> >> at >> amplify.adnetworks.appnexus.ANStatsUpdater$AdvertiserStatsRetriever.run( >> ANStatsUpdater.java:227) ~[classes/:na] >> >> Any ideas what the issue could be here? >> >> Ian. >> >> > > > -- > Ian Clarke > Blog: http://blog.locut.us/ > > -- Ian Clarke Blog: http://blog.locut.us/
