0

I need to get the auto-increment ID generated by MySQL for my INSERT INTO xxx ....

I know I can get the auto-generated ID for the INSERT DML by Slick DSL, as mentioned in the question of Slick 3.0 Insert and then get Auto Increment Value

But is there any simple solution to get the ID with Slick Plain SQL? I mean sqlu""" INSERT INTO xxx """.

Maybe I can perform INSERT & SELECT LAST_INSERT_ID() in a single MySQL transaction to achieve it? But not sure if it's a recommended way.

Is there any single statement solution to ti?

Thanks!

user6502167
  • 731
  • 9
  • 18

1 Answers1

0

Finally I use the way as (insertTaskAction andThen selectTaskIdAction).transactionally, although transactionally may not quite necessary.

user6502167
  • 731
  • 9
  • 18