H2 DB Database.connect("jdbc:h2:mem:test" , driver = "org.h2.Driver" ) transaction { // insert new city. SQL: INSERT INTO Cities (name) VALUES ('St. Petersburg') val stPete = City.new { name = "St. Petersburg" } // 'select *' SQL: SELECT Cities.id, Cities.name FROM Cities println("Cities: ${City.all()}") } } object Cities: IntIdTable() { val name = varchar("name", 50) } class City(id: EntityID<Int>) : IntEntity(id) { companion object : IntEntityClass <City>(Cities) var name by Cities.name }
16 出典 | https://github.com/JetBrains/Exposed/wiki/Getting-Started