Insert data and get back id in mybatis
I should save the record in the database and get the record id in the response. After a long search and research I came up with the following option.
data class User(
val id: UUID? = null,
val username: String,
...
)
UserRepo:
@Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
@Insert("""
INSERT INTO "user" (
username,
...
) VALUES (
#{username},
...
)
""")
fun save(user:...