Questions tagged [kotlin-exposed]

Exposed is Kotlin's SQL library. Use with the [kotlin] tag

Exposed is a SQL library made by Jetbrains (the creators of Kotlin)

Exposed is a prototype for a lightweight SQL library written over JDBC driver for Kotlin language. It does have two layers of database access: typesafe SQL wrapping DSL and lightweight data access objects

245 questions
0
votes
1 answer

Can i use Exposed, Kotlin library, for opening and working with previously created databases? And how should i do that?

Im writing an kotlin desktop application that will allow me to read data from text files and save it into database. After saving this database as a file, i want to use it in my android application. I'm using Exposed, kotlin library, and H2 for my…
MadRat
  • 1
  • 1
0
votes
1 answer

CRUD with table relationship using KTOR and EXPOSED

I'm having problems with KTOR and EXPOSED for a crud using relationship between tables. I configured my service as follows: class LegalPersonService { suspend fun findAll(): List = dbQuery { LegalPersons.selectAll().map {…
Rodrigo Batista
  • 383
  • 1
  • 6
  • 16
0
votes
2 answers

How to perform SQL "SELECT SUM(item.cost * item.amount)... " query

im trying to write equivalent of SQL query: SELECT tax.name as tax, SUM(item.cost * item.amount) as total FROM Invoices inv JOIN InvoiceItems item ON( item.invoice = inv.id ) JOIN Taxes tax ON( tax.id = it.tax ) WHERE inv.id = 1 GROUP BY tax.id I…
Ota Klapka
  • 23
  • 4
0
votes
0 answers

JetBrains Exposed throws error when trying to create a transaction

SQLService.kt // Start connection Database.connect("jdbc:mysql://127.0.0.1:3306/rsmod", driver = "com.mysql.jdbc.Driver", user = "root", password = "") // Create tables if not yet created transaction { // This line errors …
Jaquarh
  • 6,493
  • 7
  • 34
  • 86
0
votes
2 answers

What would be the eqivalent of show tables from MySQL in Kotlin Exposed

Trying out Kotlin Exposed for the first time. I have been able to learn Kotlin to a reasonable extent now and now I'm trying to learn Kotlin Exposed API for database access. But I'm unable to find an equivalent for SHOW tables; of MySQL. It would…
Deepan
  • 124
  • 1
  • 10
0
votes
1 answer

Why I receive an error when I use exposed in Kotlin?

I need to receive region_name by region_code from Oracle DB I use Exposed for my program, but I receive error in thread "main" java.lang.AbstractMethodError at org.jetbrains.exposed.sql.Transaction.closeExecutedStatements(Transaction.kt:181) at…
Sergei
  • 21
  • 1
0
votes
1 answer

Select query as where condition in Exposed

How to use DSL method to generate a SELECT query in WHERE? Example: SELECT * FROM table WHERE id IN ( SELECT MAX(id) FROM table GROUP BY name );
Zouyiu Ng
  • 193
  • 1
  • 12
0
votes
0 answers

Any way with Exposed to do an ON UPDATE in a table declaration?

I want to update a time stamp similar to MySQLs "ON UPDATE CURRENT_TIMESTAMP". Is there anyway to do this when declaring a table in Exposed?
Adam
  • 25,966
  • 23
  • 76
  • 87
0
votes
1 answer

How do we compose queries in Kotlin Exposed?

I would like to create something similar to Ruby's ActiveRecord Scopes using Kotlin Exposed. For example I would like to break the following query up so that the first part acts like a scope. This query returns what I want. val m1 =…
nPn
  • 16,254
  • 9
  • 35
  • 58
0
votes
0 answers

Binding data to view model when dealing with DAO and Tornadofx

I am making database operations with JetBrains/Exposed. I was able to make use of the DAO approach to display data from the database on the TableView. It was quite challenging with the DSL approach. After succeeding to display data, data binding was…
The Oracle
  • 2,373
  • 3
  • 26
  • 44
0
votes
2 answers

postgresql Transaction isolation level 4 not supported

I am Trying to create table (postgres + exposed + ktor + JDBC), I got that error. Find bellow the configuration I have: build.gradle compile group: 'postgresql', name: 'postgresql', version: '9.0-801.jdbc4' Hello.kt object Pays : Table() { val id…
0
votes
1 answer

Kotlin Exception in thread "main" org.postgresql.util.PSQLException: ERROR

I'm using Kotlin Exposed for ORM in my Web application. I have an Entity User and it was created in the database(PostgreSQL) I have a problem when I want to find a value in a table(User), show me this Error Exception in thread "main"…
Mohammad Daliri
  • 1,370
  • 6
  • 20
  • 43
0
votes
1 answer

Flywaydb error in kotlin

I want to use flywaydb in Kotlin but I have an error in use My database is PostgreSQL and my ORM is Kotlin Exposed Code: val url = "jdbc:postgresql://127.0.0.1/test1" Database.connect(url, driver = "org.postgresql.Driver", user = "postgres",…
Mohammad Daliri
  • 1,370
  • 6
  • 20
  • 43
0
votes
1 answer

How do I search from multiple tables with DAO?

Say I have tables like this: object Leagues : IntIdTable() { val name = varchar("name", 50).uniqueIndex() } object Matches: IntIdTable() { val game = reference("game", Games) } object Users: IntIdTable() { val name = varchar("name",…
Tatu Lahtela
  • 4,514
  • 30
  • 29
0
votes
0 answers

Unresolved reference: new in Exposed

I'm starting Exposed ORM in use Kotlin from this link I want to create User Table but show this error : Error:(67, 14) Kotlin: Unresolved reference: new User object and Entity class : object Users : IntIdTable() { val name = varchar("name",…
Mohammad Daliri
  • 1,370
  • 6
  • 20
  • 43
1 2 3
16
17