https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
exposed
  • v

    Vinicius Araujo

    06/13/2019, 4:52 PM
    Does anyone have an example on how to use a H2 connection for unit testing, and use the default connection for real usage without setting the connection by parameter?
    j
    • 2
    • 12
  • k

    Kevin Schmeichel

    06/13/2019, 5:51 PM
    Is there a way to create an integer column that is also a foreign key (with a single statement)?
    t
    • 2
    • 1
  • t

    tjohnn

    06/14/2019, 2:07 PM
    Just curious, from docs on eager loading:
    Exposed can eager load them at the time of the parent query, this is prevents the classic "N+1" problem as references can be aggregated and loaded in a single query
    Does it mean only one query would be made to database to query the parent and its child references?
    t
    • 2
    • 2
  • m

    Mihael

    06/14/2019, 3:01 PM
    Is there any chance you can do
    day(date_time)
    equivalent in exposed?
    t
    • 2
    • 3
  • t

    tjohnn

    06/16/2019, 3:11 PM
    Am I doing anything wrong here? I created a role
    val id =  Roles.insertAndGetId { it[name] = ROLE_ADMIN;it[createdAt] = DateTime.now();it[updatedAt] = DateTime.now() }
    Then any attempt to insert a user with the role like this:
    UserEntity.new {
                    email = "<mailto:admin@test.com|admin@test.com>"
                    roleId = id
                    emailVerified = true
                    password = 'password'
                    createdAt = DateTime.now()
                    updatedAt = DateTime.now()
                }
    I get the following error:
    INFO  Exposed - Transaction attempt #2 failed: Invalid argument value: java.io.NotSerializableException. Statement(s): null
    t
    • 2
    • 5
  • v

    Vinicius Araujo

    06/17/2019, 6:39 PM
    In DSL, how can I reference an `UUIDTable`'s id? I get an error saying
    Column<EntityId<UUID>>
    is different from
    Column<UUID>
    t
    • 2
    • 2
  • k

    Kevin Schmeichel

    06/18/2019, 10:46 PM
    I'm getting a
    ModuleVersionNotFoundException
    when I try to upgrade.
    t
    • 2
    • 2
  • m

    Mihael

    06/24/2019, 8:37 AM
    Is there a better way of checking if a table exists than
    if (Table(tableName).exists()) {
    ?
    p
    • 2
    • 1
  • s

    spand

    06/26/2019, 7:41 AM
    Is it possible to create my own operator on
    SqlExpressionBuilder
    somehow ?
    t
    • 2
    • 11
  • b

    bitkid

    06/27/2019, 9:38 PM
    i saw that there are now new methods supporting coroutines. how can i pass the isolationLevel and the repetitionAttempts to suspendedTransaction?
    t
    • 2
    • 5
  • l

    lenqnr

    06/30/2019, 9:12 AM
    How can I achieve
    UNION
    operator with Exposed DSL? I want to execute something like:
    SELECT MAX(views) FROM (
        SELECT views FROM articles WHERE user_id = 1
        UNION ALL
        SELECT views FROM comments WHERE user_id = 1
    ) as writings
    t
    • 2
    • 2
  • r

    runjorel

    07/01/2019, 7:39 PM
    Does the DAO api allow for batch insert?
    t
    • 2
    • 3
  • r

    runjorel

    07/07/2019, 6:15 AM
    How can I use a sub query in an update statement ? Contrived Example:
    UPDATE Users SET active=false WHERE id IN (SELECT user_id FROM deactivated)
    It seems the only option I have is
    inList
    but I am afraid if I call
    map{..}/toList()
    on my subquery it would materialize those results.
    t
    • 2
    • 3
  • r

    runjorel

    07/08/2019, 3:24 PM
    Question about
    suspendedTransaction
    . Whenever I try to call another suspending function within a suspendingTransaction, I am getting an error about coroutine contexts. Is that not allowed?
    t
    • 2
    • 3
  • s

    SrSouza

    07/08/2019, 10:54 PM
    Hi @tapac, you can tell me the difference between Blob and Binary columns? And in the future you add like a column for ByteReadPacket using Blob?
    t
    • 2
    • 4
  • b

    bitkid

    07/09/2019, 9:44 PM
    Database.connect(datasource = HikariDataSource(poolConfig),
                manager = { ThreadLocalTransactionManager(it, Connection.TRANSACTION_REPEATABLE_READ, 0) })
    t
    • 2
    • 9
  • t

    tjohnn

    07/11/2019, 1:35 PM
    Hi, I am trying to do batch upsert with the help of this article https://medium.com/@OhadShai/first-steps-with-kotlin-exposed-cb361a9bf5ac but I get
    KotlinNullPointerException
    whenever I attempt to use it for inserting a new data which doesn't have an id, the id being null is the cause of the error based on what I see so far, the id is auto_increment so I cannot set it explicitly, is there a way for me to fix this or Am I doing something wrong?
    r
    t
    • 3
    • 20
  • v

    vagarwala

    07/11/2019, 8:20 PM
    hey @runjorel I’ve finally got it working nicely. thank you so much for your help, i really do appreciate it!
    💯 1
    r
    • 2
    • 4
  • r

    runjorel

    07/12/2019, 7:33 PM
    I can’t seem to do a
    batchInsert
    for a
    List<T>
    because
    batchInsert
    will only accept a
    List<Any>
    . Anyone else with that issue?
    t
    t
    • 3
    • 6
  • h

    Hamza

    07/13/2019, 1:08 PM
    PostgreSQL is giving me a couple of issues, and I'm not sure what the issue is. I have a simple main fuction at the moment with just connects to my database, and a transaction. i simple application is giving me the error
    Caused by: org.postgresql.util.PSQLException: This ResultSet is closed.
    which is quite curious
    Database.connect(
            url = "jdbc:<postgresql://localhost:5432/library>",
            user = "hm",
            password = "wouldn't u like to know",
            driver = "org.postgresql.Driver"
        )
    
        transaction {
            Books.select { Op.TRUE }.forEach(::println)
        }
    t
    • 2
    • 6
  • j

    jeggy

    07/15/2019, 2:53 PM
    I'm trying to upgrade Exposed from 0.10.3 to 0.16.1. But having problems with this change: https://github.com/JetBrains/Exposed/compare/0.10.3...0.10.4#diff-fe7686cefd0bc6d3c1dd26591a0a46a5R197 giving me:
    java.lang.IllegalStateException: transaction.connection.catalog must not be null
    Anyone that can help me here? what do I need to make sure that when Exposed is calling
    getDatabase
    it won't return
    null
    ?
    • 1
    • 2
  • t

    tapac

    07/17/2019, 8:22 PM
    Exposed 0.16.2 was released with fix for annoying
    connection is closed
    exception when using suspended transactions. suspended functions was changed a bit, documentation will be actualized soon.
    🎉 3
    b
    • 2
    • 1
  • r

    Rodrigo Silva

    07/21/2019, 12:22 PM
    Hello all. I'm creating a multi tenant database, using Postgres, but I'm having trouble. Have this: object User: Table ("schema_name.table_name") { // fields } But I would like to do something like this. object User: Table ("$ {schema_name_dynamically} .table_name") { // fields } And the schema name would come with the request. Or something like that. It's possible? Or is there a better approach? I'm currently using a single schema separating each tenant by an "id_tenant", but I would like to separate by schemas.
    t
    • 2
    • 1
  • m

    mp

    07/23/2019, 1:39 PM
    hi there want to ask - does exposed contains any staff related to entity auditing?
    t
    • 2
    • 2
  • h

    Hamza

    07/25/2019, 11:11 AM
    contrary, is there a way to completely disable debug logging?
    t
    • 2
    • 1
  • s

    SrSouza

    07/26/2019, 8:21 PM
    Hi guys, I'm using DAO and I have a Table in other database, how I can reference a column in this table that is in other database with Exposed?
    t
    • 2
    • 6
  • p

    Polis Gints

    08/06/2019, 12:02 PM
    fun insertBlog(blog: Blog) { return transaction { Blogs.insert { it[message] = blog.message } } }
    s
    • 2
    • 3
  • k

    Kevin Schmeichel

    08/06/2019, 5:06 PM
    }
    p
    • 2
    • 5
  • l

    Luis Munoz

    08/09/2019, 3:22 PM
    I am using exposed for a small project and it works great. It somewhat bothers me that it is built on a blocking api JDBC although I don't understand the ramifications. Is there any article or can someone please explain why exposed built on top that blocking API and the performance penalties it will have verses using r2dbc?
    t
    • 2
    • 1
  • s

    Shawn A

    08/19/2019, 8:05 PM
    Looking at using Exposed. After reading the docs I am not entirely sure where I should be calling
    Database.connect
    . I think it should be called one time when the application starts. But after I call it, do I need to reference it to interact with the
    db
    . All the examples I've seen don't use the
    Database
    object directly. How do the table objects get a handle to the current
    Database
    ?
    j
    • 2
    • 2
Powered by Linen
Title
s

Shawn A

08/19/2019, 8:05 PM
Looking at using Exposed. After reading the docs I am not entirely sure where I should be calling
Database.connect
. I think it should be called one time when the application starts. But after I call it, do I need to reference it to interact with the
db
. All the examples I've seen don't use the
Database
object directly. How do the table objects get a handle to the current
Database
?
Ok, looks like a
ThreadLocalTransactionManager
manager is used.
j

Jonathan Mew

08/20/2019, 7:37 AM
I think you should usually only need to use the db object directly if you wish to connect to multiple databases from the same app
👍 1
View count: 4