INSERT INTO Messages (name) VALUES ('Hello Kotlin Developers!') UPDATE Messages SET name='Hello Spring-Kotlin Developers' WHERE Messages.id = 1 DROP TABLE Messages
Get all the users from the database:
for (message in Messages.selectAll()) { println("$message[Messages.name]}") }
It will result in the following query:
SELECT Messages.name FROM Messages;
Now it must be pretty clear how to use the Exposed library for Spring and how it works internally.
The reason for using the Exposed library instead of Spring JPA is because, at the time of writing, there is no official support for Kotlin data classes and JPA, that is Spring Data JPA. JetBrains noticed this and they released their own SQL ORM library called Exposed.
Read more at https://github.com/JetBrains/Exposed.