Hi, I'm sorry for the delay - I've noticed this message has been left unanswered.
Is this still an issue on your side? If it is, can you please provide the exact code that is causing problems? I'm not sure how to use your code to reproduce this issue. Also, you mention using keepStatement() here, but it is not used in your code... Thanks, Lukas 2017-03-29 10:13 GMT+02:00 yahim stnsc <[email protected]>: > > Hi all > > The context > - mysql > - .returning() statement > - .keepStatement(true) > > Problem: > When using keepStastement(true) if i do two inserts in the same > transaction i get the same number however does not happen with > keepStatement(fasse). > > Looks like a bug in JOOQ in the simulated implementation of returning > maybe. Any ideas? > > Here is my code. getOrCreatePreparedQUery is just a wrapper (hopefully you > get the idea). Logs below > > final Long messageId = > // getOrCreatePreparedQuery( > // getClass().getCanonicalName() + "insertMessage", > // () -> > getDslContext() > .insertInto(Tables.TOPIC_MESSAGE) > .columns( > > Tables.TOPIC_MESSAGE.MESSAGE_INDEX, > > Tables.TOPIC_MESSAGE.MESSAGE_UUID, > > Tables.TOPIC_MESSAGE.TOPIC_ID, > > Tables.TOPIC_MESSAGE.CREATED_AT, > > Tables.TOPIC_MESSAGE.MESSAGE > ) > .values( > topic.getTopicIndex(), > messageUuid, > topic.getTopicId(), > > Timestamp.from(Instant.now()), > message > ) > > .returning(Tables.TOPIC_MESSAGE.MESSAGE_ID) > // , > // query -> query.bind(1, topic.getTopicIndex()) > // .bind(2, messageUuid) > // .bind(3, topic.getTopicId()) > // .bind(4, > Timestamp.from(Instant.now())) > // .bind(5, message) > // ) > .fetch() > .get(0) > .getMessageId(); > > > *With prepared statement (the two inserts)* > > > 2017-03-29 10:09:29,622 DEBUG jooq.tools.LoggerListener:254 - Executing query > : insert into `TestQtalkNG`.`topic_message` (`message_index`, > `message_uuid`, `topic_id`, `created_at`, `message`) values (?, ?, ?, ?, ?) > 2017-03-29 10:09:29,622 DEBUG jooq.tools.LoggerListener:254 - -> with bind > values : insert into `TestQtalkNG`.`topic_message` (`message_index`, > `message_uuid`, `topic_id`, `created_at`, `message`) values (1, > X'75ea5ab011124610a14a8755b3a90c97', 1799, {ts '2017-03-29 10:09:29.621'}, > X'3f43cc9e4f74c2ab74c5a8be50cc2116') > 2017-03-29 10:09:29,623 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 1 : 1 (class java.lang.Long) > 2017-03-29 10:09:29,623 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 2 : [B@771b0f1 (class [B) > 2017-03-29 10:09:29,626 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 3 : 1799 (class java.lang.Integer) > 2017-03-29 10:09:29,626 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 4 : 2017-03-29 10:09:29.621 (class java.sql.Timestamp) > 2017-03-29 10:09:29,626 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 5 : [B@4d1f044c (class [B) > 2017-03-29 10:09:29,627 TRACE jooq.tools.StopWatch:182 - Variables bound > : Total: 4.978ms, +3.317ms > 2017-03-29 10:09:29,627 TRACE jooq.tools.StopWatch:182 - Executing query > : Total: 5.064ms, +0.085ms > 2017-03-29 10:09:29,627 DEBUG jooq.tools.LoggerListener:254 - Affected row(s) > : 1 > 2017-03-29 10:09:29,627 DEBUG jooq.tools.StopWatch:254 - Query executed > : Total: 5.693ms, +0.629ms > 2017-03-29 10:09:29,632 DEBUG jooq.tools.StopWatch:254 - Finishing > : Total: 10.862ms, +5.169ms > > 2017-03-29 10:09:29,633 INFO > messagestore.vertxhandlers.MessageStoreManager:94 - messageId=851 > > > 2017-03-29 10:09:29,648 TRACE jooq.tools.StopWatch:182 - Binding variables > : Total: 0.149ms, +0.142ms > 2017-03-29 10:09:29,648 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 1 : 2 (class java.lang.Long) > 2017-03-29 10:09:29,651 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 2 : [B@4f8001a9 (class [B) > 2017-03-29 10:09:29,652 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 3 : 1799 (class java.lang.Integer) > 2017-03-29 10:09:29,652 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 4 : 2017-03-29 10:09:29.648 (class java.sql.Timestamp) > 2017-03-29 10:09:29,652 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 5 : [B@1895de24 (class [B) > 2017-03-29 10:09:29,652 TRACE jooq.tools.StopWatch:182 - Variables bound > : Total: 4.218ms, +4.069ms > 2017-03-29 10:09:29,652 TRACE jooq.tools.StopWatch:182 - Executing query > : Total: 4.366ms, +0.147ms > 2017-03-29 10:09:29,653 DEBUG jooq.tools.LoggerListener:254 - Affected row(s) > : 1 > 2017-03-29 10:09:29,653 DEBUG jooq.tools.StopWatch:254 - Query executed > : Total: 5.002ms, +0.635ms > 2017-03-29 10:09:29,653 DEBUG jooq.tools.StopWatch:254 - Finishing > : Total: 5.364ms, +0.362ms2017-03-29 10:09:29,653 INFO > messagestore.vertxhandlers.MessageStoreManager:94 - messageId=851 > > > *Without prepared statement (the two inserts)* > > > > 2017-03-29 10:11:45,218 DEBUG jooq.tools.LoggerListener:254 - Executing query > : insert into `TestQtalkNG`.`topic_message` (`message_index`, > `message_uuid`, `topic_id`, `created_at`, `message`) values (?, ?, ?, ?, ?) > 2017-03-29 10:11:45,222 DEBUG jooq.tools.LoggerListener:254 - -> with bind > values : insert into `TestQtalkNG`.`topic_message` (`message_index`, > `message_uuid`, `topic_id`, `created_at`, `message`) values (1, > X'8318809930eb4c27a5b931d31623ae1a', 1800, {ts '2017-03-29 10:11:45.216'}, > X'81bd32099af93e56db9109786cdc4d1c') > 2017-03-29 10:11:45,224 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 1 : 1 (class java.lang.Long) > 2017-03-29 10:11:45,224 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 2 : [B@8bc8d6f (class [B) > 2017-03-29 10:11:45,225 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 3 : 1800 (class java.lang.Integer) > 2017-03-29 10:11:45,225 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 4 : 2017-03-29 10:11:45.216 (class java.sql.Timestamp) > 2017-03-29 10:11:45,225 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 5 : [B@7d87144c (class [B) > 2017-03-29 10:11:45,225 TRACE jooq.tools.StopWatch:182 - Variables bound > : Total: 8.833ms, +1.622ms > 2017-03-29 10:11:45,225 TRACE jooq.tools.StopWatch:182 - Executing query > : Total: 8.968ms, +0.135ms > 2017-03-29 10:11:45,226 DEBUG jooq.tools.LoggerListener:254 - Affected row(s) > : 1 > 2017-03-29 10:11:45,226 DEBUG jooq.tools.StopWatch:254 - Query executed > : Total: 9.814ms, +0.845ms > 2017-03-29 10:11:45,235 DEBUG jooq.tools.StopWatch:254 - Finishing > : Total: 18.92ms, +9.105ms > > 2017-03-29 10:11:45,236 INFO > messagestore.vertxhandlers.MessageStoreManager:94 - messageId=855 > > > 2017-03-29 10:11:45,259 DEBUG jooq.tools.LoggerListener:254 - Executing query > : insert into `TestQtalkNG`.`topic_message` (`message_index`, > `message_uuid`, `topic_id`, `created_at`, `message`) values (?, ?, ?, ?, ?) > 2017-03-29 10:11:45,260 DEBUG jooq.tools.LoggerListener:254 - -> with bind > values : insert into `TestQtalkNG`.`topic_message` (`message_index`, > `message_uuid`, `topic_id`, `created_at`, `message`) values (2, > X'562918fb942c4252b274156981476ab0', 1800, {ts '2017-03-29 10:11:45.255'}, > X'412ffc45a5d206be8733230475dfc554') > 2017-03-29 10:11:45,261 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 1 : 2 (class java.lang.Long) > 2017-03-29 10:11:45,261 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 2 : [B@72fd12d6 (class [B) > 2017-03-29 10:11:45,261 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 3 : 1800 (class java.lang.Integer) > 2017-03-29 10:11:45,261 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 4 : 2017-03-29 10:11:45.255 (class java.sql.Timestamp) > 2017-03-29 10:11:45,262 TRACE jooq.impl.DefaultBinding:182 - Binding variable > 5 : [B@56ee435 (class [B) > 2017-03-29 10:11:45,262 TRACE jooq.tools.StopWatch:182 - Variables bound > : Total: 6.034ms, +1.02ms > 2017-03-29 10:11:45,262 TRACE jooq.tools.StopWatch:182 - Executing query > : Total: 6.154ms, +0.12ms > 2017-03-29 10:11:45,263 DEBUG jooq.tools.LoggerListener:254 - Affected row(s) > : 1 > 2017-03-29 10:11:45,263 DEBUG jooq.tools.StopWatch:254 - Query executed > : Total: 7.101ms, +0.946ms > 2017-03-29 10:11:45,263 DEBUG jooq.tools.StopWatch:254 - Finishing > : Total: 7.509ms, +0.407ms > > 2017-03-29 10:11:45,263 INFO > messagestore.vertxhandlers.MessageStoreManager:94 - messageId=856 > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
