https://kotlinlang.org logo
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
  • p

    Pepperbc

    07/04/2020, 3:42 AM
    Hi - is there a way to create the SQL for { it[name] = "foo" } and { it[director] = "bar") }, to then later combine them and call Movies.update() { it[name] = "foo") ; it[director] = "bar" }
    e
    • 2
    • 2
  • j

    Joel

    07/17/2020, 9:29 PM
    It's unclear to me how the default connection works. The docs say the latest connection is the default. Does this truly mean that the latest call of
    Database.connect
    is the default db? This is inconvenient when working with Spring Boot because bean creation order is undefined.
    h
    t
    • 3
    • 15
  • j

    Joel

    08/03/2020, 1:22 PM
    @tapac thanks for the postgres index fix! Am I looking for a 0.26.2?
    t
    • 2
    • 1
  • t

    tapac

    08/03/2020, 10:16 PM
    Hello, everyone! Long time no see. Sorry for "silence mode" while I was on vacation with almost no internet. But I'm back and plan to check all new issues and PR in a few days. There are a few bug fixes pending in a master branch, so let's start with a bug-fix release 0.26.2. Please, check release note to see the full list of changes.
    🎉 5
    s
    • 2
    • 1
  • y

    Yoavya

    08/04/2020, 7:31 AM
    Hi, I want to create a custom count, normally when I want to count a column I just
    columnX.count()
    in the slice part of the query. I want to do something like this
    count(*) filter ( where columnX in ('a', 'b') ) as custom_count
    is there an easy way to achieve this? Thanks 🙂
    j
    t
    • 3
    • 9
  • j

    Joel

    08/04/2020, 11:36 AM
    @tapac welcome back! Hopefully an easy question as you dive back into code - does the new composite column support nullability?
    t
    • 2
    • 2
  • t

    Tobias G. Waaler

    08/06/2020, 6:27 PM
    Hi, Thank you for creating Exposed, I'm having a great time learning the library 🙂 I was just wondering if it would be a good idea to change the
    adjustSlice
    function from
    fun adjustSlice(body: ColumnSet.() -> FieldSet): Query = apply { set = set.source.body() }
    to something like
    fun adjustSlice(body: ColumnSet.(FieldSet) -> FieldSet): Query = apply { set = set.source.body(set) }
    That way you can get a hold of fields that are currently a part of the fieldset for the query and do things like adding additional fields (or even removing fields). To me this was useful when I wanted to add a single extra field to the slice, depending on some condition. Currently I've created this extension function that I'm using, and it works quite well:
    fun Query.addToSlice(vararg columns: Expression<*>): Query {
        return adjustSlice {
            slice(this@addToSlice.set.fields + columns)
        }
    }
    t
    • 2
    • 2
  • j

    Joel

    08/12/2020, 3:42 PM
    The JDBC layer is parsing the value to
    BigDecimal
    correctly but it appears that Exposed is rounding the precision to that of the original column.
    t
    • 2
    • 3
  • m

    mmaillot

    08/18/2020, 2:35 PM
    Hi! I have a
    UUIDTable
    `Intervention`with a child:
    val foreignEnterprise = reference("foreign_enterprise", ForeignEnterprises.id)
    . I want to get the foreign enteprise for an intervention. I have the
    InterventionUuid
    . How can I do ? In SQL, I do: SELECT foreign_enterprise.* from foreign_enterprise, intervention WHERE intervention.foreign_enteprise_id = foreign_enterprise_id AND intervention.id ='`INPUT_UUID`'.
    j
    • 2
    • 3
  • p

    Philipp Mayer

    08/18/2020, 4:02 PM
    Hey guys! I'm currently working with Exposed and its a breeze! However, I stumbled upon a thing that I don't quite understand yet. I have the following table:
    object Sensors : IntIdTable() {
        val roomId = reference("id", Rooms.id).nullable()
        val name = text("name")
    }
    And now I just want to select all rows and map them to my domain Object:
    class Sensor(
            val id: Int?,
            val roomId: Int?,
            val name: String
    )
    
    Sensors.selectAll().map {
          Sensor(it[id], it[roomId], it[name])
    }
    However, if I do it as shown, I get an alert saying that
    it[id]
    is of type string (while I expect an int). Ist htere a better way? Why is it like that, even though my table definition is different? Thanks in advance!
    t
    • 2
    • 2
  • i

    Ivan

    08/19/2020, 4:52 AM
    Hi @tapac. When do you think to update exposed to kotlin 1.4? Thx
    t
    j
    • 3
    • 2
  • m

    manlan

    08/22/2020, 4:29 AM
    Exposed doesn't work with NoSQL DBs, correct?
    t
    • 2
    • 1
  • z

    zero_coding

    08/23/2020, 8:40 AM
    the question is, how to create it?
    t
    • 2
    • 4
  • d

    darkmoon_uk

    08/24/2020, 2:23 PM
    How do I simply have a collection of strings in an object? (Using DAO) This basic use case doesn't seem to be catered for in the DAO guide. I can see how to do it with a full 'Entity' for each string, each with its ID and reference etc, but this is unnecessarily heavy - just a table with 'parentId, string' should be all that's necessary to implement the one-to-many relationship. I can't believe Exposed has missed this out...
    t
    • 2
    • 1
  • z

    zero_coding

    08/26/2020, 11:21 AM
    Hi all I have defined a table with custom primary key:
    object Genders : Table() {
        val value: Column<String> = varchar("value", 1)
        val description: Column<String> = varchar("description", 20)
        override val primaryKey = PrimaryKey(value)
    }
    As next, I would like to create an Entity class for it and I have tried:
    class Gender(v: EntityID<String>) : Entity<String>(v) {
        companion object : EntityClass<String, Gender>(???)
    
        var value by Genders.value
        var description by Genders.description
    }
    k
    • 2
    • 6
  • z

    zero_coding

    08/30/2020, 8:50 AM
    How to create an entity without
    transaction
    and later do the transaction.
    k
    • 2
    • 1
  • w

    Wyatt Kennedy

    08/31/2020, 7:58 PM
    Hi, I've been working on a project using exposed for a bit and was wondering if there is any convenience functionality for audit fields like created & updated timestamps or soft delete logic with a deleted column? If so, is it documented anywhere? If not, are there any plans/issues for adding it, (but just super low priority)? Didn't want to reinvent the wheel here if I didn't have to.
    k
    • 2
    • 2
  • m

    Mranders

    09/01/2020, 8:35 AM
    What is the correct way to create a NULL valued expression? Let's say I want a branch of a case/when/else to result in NULL.
    k
    t
    • 3
    • 5
  • m

    mp

    09/01/2020, 10:11 AM
    hi there. guys if we assume that we have some kind of sealed hierarchy of classes (with common fields in base classes, and some specific in the, subclasses)
    sealed class A {
        abstract val a: Int
    
        data class B(val b: String, override val a: Int) : A()
        data class C(val c: Boolean, override val a: Int) : A()
    }
    persist those B,C classes to single table, with nullable b and c fields - make it any sense from exposed point of view? I’ve tried to google some samples for this but without success. thats why interesting to ask about it( maybe this idea some example of sick imagination of mine 😃)
    t
    • 2
    • 2
  • n

    neetkee

    09/02/2020, 9:32 AM
    Hello, is it possible to wrap row into entity, that was left joined and can be null?
    • 1
    • 1
  • d

    Das135

    09/03/2020, 1:38 PM
    Hi! Is it possible to get transaction context inside other thread? I have code like this:
    transaction {
                FirstObject.selectAll()
                supplyAsync {
                    runBlocking {
                        SecondObject.selectAll()
                    }
                }
            }
    I need to do both calls inside one transaction. When calling
    SecondObject.selectAll()
    , I got exception
    No transaction in context
    . https://github.com/JetBrains/Exposed/wiki/Transactions#working-with-coroutines -> This should probably help me, but I did not fully understand how to use it.
    t
    • 2
    • 1
  • m

    manlan

    09/11/2020, 8:45 PM
    How do I make a column refer to multiple rows in a different table?
    t
    • 2
    • 2
  • d

    Dmitry Lapshin

    09/16/2020, 12:30 PM
    Hi! I am manually wrapping outer join result in DAO objects. How can I check that a column is null?
    s
    • 2
    • 3
  • j

    Joel

    09/16/2020, 2:52 PM
    Is there a way to wrap a constant as a query? i.e.
    SELECT 1
    v
    t
    • 3
    • 5
  • d

    degreat

    09/19/2020, 11:49 AM
    INSERT IGNORE...
    throws an exception when using H2. I'm up-to-date with exposed and h2 drivers... Am I missing anything else?
    t
    t
    • 3
    • 2
  • m

    Mihael

    09/22/2020, 12:48 PM
    Is it possible for me to somehow make two Tables with the same structure without copying the code?
    t
    • 2
    • 3
  • p

    paulex

    09/26/2020, 10:11 AM
    Good Morning
    t
    • 2
    • 1
  • v

    Vinicius Araujo

    09/30/2020, 1:19 AM
    Good night! It may be a getting started coroutine question, but since its subject is strictly related to exposed, maybe someone can help me with an expecifc use case insight. So if I do it like this:
    fun addA() = transaction{A insert statement}
    fun addB() = trabsaction{B insert statement}
    
    suspend fun applyAandB() = coroutineScope {
        launch { addA() }
        launch { addB() }
    }
    would them execute asyncronously?
    s
    t
    • 3
    • 4
  • j

    Júlio Santos

    09/30/2020, 5:52 PM
    Speak up, guys! I'm putting together a clause where exposed this way
    Employee.select { Employee.id = id and (Employee.name = name)}
    is that correct?
    👍 1
    🇳🇴 2
    s
    t
    • 3
    • 3
  • r

    Reprator

    10/04/2020, 4:06 PM
    Hi Team, need little help with this weird issue, i hope i will get some sort of assistance or hint hereStackoverflow question
    b
    t
    • 3
    • 10
Powered by Linen
Title
r

Reprator

10/04/2020, 4:06 PM
Hi Team, need little help with this weird issue, i hope i will get some sort of assistance or hint hereStackoverflow question
b

Bogdan

10/04/2020, 8:27 PM
MAX_COLUMN_LENGTH = ?
it is worth clarifying the platform, DBMS, JDBC Driver and its version
PS: the inserted string (the token, as I understand it) has 313 characters, and the column can accept up to 255 symbols
r

Reprator

10/05/2020, 4:30 AM
MAX_COLUMN_LENGTH = 1000
postgres
jdbc driver
@Bogdan thanks for the clarification, i had updated my question
t

tapac

10/05/2020, 11:21 PM
@Reprator, looks vey similar to https://github.com/JetBrains/Exposed/issues/1029 I plan to release new version with this fix on that week.
r

Reprator

10/06/2020, 9:06 AM
yes, infact it is, the same issue
@tapac, so this issue is fixed or u are going to release a new version
View count: 4