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
  • e

    Emery Tanghanwaye

    04/28/2020, 1:32 AM
    companion object : IntEntityClass<StarWarsFilm>(StarWarsFilms)
    What exactly is this line?
    t
    • 2
    • 1
  • c

    christophsturm

    04/28/2020, 1:39 PM
    I’m getting this test failure:
    java.lang.AssertionError: Failed on sqlite expected:<2020-04-28T13:36:40.867901> but was:<2020-04-28T13:36:40.867>
    	at org.junit.Assert.fail(Assert.java:88)
    	at org.junit.Assert.failNotEquals(Assert.java:834)
    	at org.junit.Assert.assertEquals(Assert.java:118)
    	at kotlin.test.junit.JUnitAsserter.assertEquals(JUnitSupport.kt:32)
    	at kotlin.test.AssertionsKt__AssertionsKt.assertEquals(Assertions.kt:51)
    	at kotlin.test.AssertionsKt.assertEquals(Unknown Source)
    	at org.jetbrains.exposed.JavaTimeTestsKt.assertEqualDateTime(JavaTimeTests.kt:57)
    t
    • 2
    • 11
  • a

    Alexander Afanasyev

    04/28/2020, 2:41 PM
    Good day! Is there any way to specify transaction isolation level for suspended transaction?
    t
    • 2
    • 4
  • c

    christophsturm

    04/29/2020, 7:56 AM
    I have a branch where i replaced mysql-mxj with testcontainers. we could possibly use testcontainers for all databases.
    t
    • 2
    • 1
  • c

    christophsturm

    04/29/2020, 10:28 AM
    related question: what code formatter settings does exposed use? or just no automatic formatting at all?
    t
    • 2
    • 1
  • s

    spand

    04/30/2020, 1:26 PM
    Say I have a
    VARCHAR
    column in MySQL with charset
    LATIN1
    . Can I specify this in the table object so it will create the correct
    CREATE TABLE
    statement ?
    t
    • 2
    • 1
  • y

    Yoavya

    05/05/2020, 9:28 AM
    Hi, I was wondering, if I want to create a reference between one table and multiple other tables. is this possible? For example: Lets say I have an Uploads table and I want Users table to have uploads and Posts table to have uploads as well. Can this be done with exposed? I mean with the
    referencedOn
    and
    referrersOn
    functions
    t
    • 2
    • 6
  • c

    codec

    05/09/2020, 1:17 AM
    Is there a select method by Primary Key, where you know that only one row will be returned?
    c
    • 2
    • 2
  • m

    MrPowerGamerBR

    05/09/2020, 5:50 PM
    Not sure if this is intentional, but... If you use
    suspendedTransactionAsync
    and a normal blocking
    transaction
    in the same coroutine, Exposed (well, in this case, HikariCP) throws a
    Connection is closed
    exception. Is this intentional? If I change the
    suspendedTransactionAsync
    to a normal
    transaction
    again, the issue goes away. If I change every
    transaction
    to a
    suspendedTransactionAsync
    , the issue also goes away. I found that bug when I found out that Exposed does support coroutines so I decided to start replacing some of my old blocking transactions with coroutine-aware methods
    👀 1
    w
    • 2
    • 2
  • a

    asad.awadia

    05/11/2020, 10:47 PM
    Does exposed only support a global app level database? I cant connect to 3 different databases and do queries?
    j
    • 2
    • 1
  • c

    codec

    05/12/2020, 7:29 AM
    @tapac At some point, will Exposed have Redis interfaces/support?
    t
    s
    • 3
    • 2
  • t

    Tmpod

    05/12/2020, 7:27 PM
    Hey! How's the coroutine support on this library? I'm looking for a coroutine-powered library to interact with postgres, but I can't really find any 😕
    w
    c
    • 3
    • 2
  • r

    Rodrigo Silva

    05/16/2020, 2:15 PM
    Hello all. How can i do this?
    • 1
    • 3
  • s

    Slackbot

    05/16/2020, 6:57 PM
    This message was deleted.
    r
    • 2
    • 2
  • b

    Bornyls Deen

    05/20/2020, 9:43 AM
    Hi everyone, I'm struggling to achieve a Postgres distinct on/order by query using the Exposed DSL... I'm looking to execute something like this
    select distinct on
        (cats.name) cats
    from 
        groups_cats
    inner join
        cats
    on
        groups_cats.cat_id = cats.id
    where
        groups_cats.cat_id = 25
    order by 
        cats.name, groups.created desc
    I've managed to come up with this
    GroupsCats
        .join(Cats, JoinType.INNER) { Cats.id eq GroupsCats.catId }
        .select { GroupsCats.catId eq catId }
        .orderBy(Cats.created to SortOrder.DESC)
    But I can't figure out how to make the result distinct on a particular column (cat name in this case)... the
    withDistinct()
    method sounded hopeful but doesn't seem to work in the way that I need. If anyone has any ideas/suggestions I would really appreciate it.
    k
    e
    • 3
    • 6
  • j

    John Towell

    05/20/2020, 8:21 PM
    has anyone made the jump from spring-boot/spring-data/JPA to spring-boot/exposed?
    👆 2
    j
    • 2
    • 1
  • n

    neetkee

    05/26/2020, 7:22 AM
    We have a strange behaviour using Exposed with spring boot and hikari with maximum pool size 1. We use this size of pool in local/test environments, and we get an error:
    HikariPool-1 - Connection is not available, request timed out after 30005ms
    Quick debugging showed, that Exposed is trying to acquire some metadata about database before transaction started. This is as far as I can get before error: org/jetbrains/exposed/sql/Database.kt:22. Is it an expected behaviour and exposed requires minimum amount of connections when used with spring, or is it something that can be fixed?
    t
    • 2
    • 4
  • p

    pafmaf

    05/26/2020, 10:44 AM
    I was using driver class
    com.impossibl.postgres.jdbc.PGDriver
    , since
    24.1
    it doesn't seem to be recognized as a postgre dialect 🤔 . Anyone got a hint before I go debugging? EDIT: nvm, found it, has it's own dialect name ("pgsql") now
    h
    • 2
    • 1
  • i

    Iaroslav Postovalov

    05/26/2020, 2:43 PM
    @tapac Hello! Is there any information about reviewing this PR: https://github.com/JetBrains/Exposed/pull/915?
    t
    • 2
    • 2
  • k

    kushalp

    06/02/2020, 2:49 PM
    I am currently on Exposed
    0.17.3
    and I'm trying to upgrade to
    0.25.1
    . A recent change has meant that I am seeing the following error when using
    Database.connect
    with `org.apache.tomcat.jdbc.pool.DataSource`:
    Overload resolution ambiguity. All these functions match.
    public final fun connect(datasource: ConnectionPoolDataSource, setupConnection: (Connection) → Unit = ..., manager: (Database) → TransactionManager = ...): Database defined in org.jetbrains.exposed.sql.Database.Companion
    public final fun connect(datasource: DataSource, setupConnection: (Connection) → Unit = ..., manager: (Database) → TransactionManager = ...): Database defined in org.jetbrains.exposed.sql.Database.Companion
    j
    • 2
    • 15
  • d

    David Glasser

    06/03/2020, 6:31 PM
    is there a way to set the “default slice” for a table? like let’s say there’s a column that i want to read in literally one codepath in my entire codebase and it doesn’t need to ever get read unless i actively add it with
    .slice
    . is that possible (if i do want to be able to be lazy and use the default ‘all columns’ slice in many places)?
    s
    • 2
    • 2
  • v

    Viet Hoang

    06/04/2020, 7:35 AM
    Hi everyone, when handling a pagination query, to get both the query result and the total number of results before
    limit
    and
    offset
    is applied in 1 query, you have to use a window function:
    SELECT foo
         , count(*) OVER() AS full_count
    FROM   bar
    WHERE  <some condition>
    ORDER  BY <some col>
    LIMIT  <pagesize>
    OFFSET <offset>;
    or in case of MySQL, the FOUND_ROWS feature:
    SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name WHERE id > 100 LIMIT 10;
    SELECT FOUND_ROWS();
    Is there a way to achieve the same thing with Exposed ?
    s
    d
    • 3
    • 4
  • p

    Philip Walford

    06/05/2020, 2:42 AM
    Hi, I’ve just raised a PR to implement replace in h2sql using the native
    MERGE INTO
    syntax. The wiki says I should look for builds of my PR in teamcity, but it isn’t showing up. Is there anything else I need to do? Here’s the PR: https://github.com/JetBrains/Exposed/pull/942
    • 1
    • 1
  • d

    David Glasser

    06/08/2020, 5:03 PM
    I feel like I haven’t quite figured out the right tricks for using the boolean expression operators (
    Expression<Boolean>.and
    and friends) w.r.t. operator precedence. Do I just need to always parenthesize every sub-expression? I guess Kotlin doesn’t really do precedence levels of custom infix operators?
    j
    • 2
    • 4
  • p

    Philip Walford

    06/09/2020, 7:28 AM
    Hey, I’ve raised a pull request to improve (in my opinion) the implementation of
    replace
    for h2sql. It passes the standard build, but I’m not really sure where to proceed from here. The Contribution guide says to
    Submit Pull Request on review.
    but I’m not sure what that actually means. What are the next steps after creating a PR?
    t
    • 2
    • 2
  • b

    breandan

    06/12/2020, 7:35 PM
    https://gitlab.com/AnimusDesign/kotlin-frm
    ❓ 1
    • 1
    • 1
  • a

    Alan Tran

    06/12/2020, 9:12 PM
    How can I declare a timestamp type to match with timestamp column in MySQL. I read the document and it shows ‘datetime’ type. But intelliJ cant import it.
    j
    • 2
    • 7
  • r

    Rodrigo Silva

    06/18/2020, 4:07 PM
    Hello everyone. I have a little problem.
    i
    • 2
    • 3
  • d

    Dougy

    06/28/2020, 4:58 AM
    Hey guys, I’m using Netty with Kotlin Exposed. The console prints out the database transactions that look like this:
    DEBUG Exposed - INSERT INTO ...
    Would anyone know how to suppress these messages?
    m
    t
    • 3
    • 2
  • d

    Don Mitchell

    06/29/2020, 2:03 PM
    I'm writing a Snowflake dialect for exposed. The good news is that 11/19 tests pass 🙂 If you're interested in this work, my fork and branch https://github.com/dmitchell/Exposed/tree/snowflake. I'd welcome critiques and help. Right now, it's failing on the prepared statements where somehow the values are not properly going to the payload.
    org.jetbrains.exposed.JavaTimeBaseTest > javaTimeFunctions STANDARD_OUT
        20:41:39,049  WARN Test worker Exposed:invoke:183 - Transaction attempt #0 failed: java.sql.SQLFeatureNotSupportedException. Statement(s): INSERT INTO CITIESTIME (LOCAL_TIME, "NAME") VALUES (?, ?)
        org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLFeatureNotSupportedException
        SQL: [INSERT INTO CITIESTIME (LOCAL_TIME, "NAME") VALUES (?, ?)]
            at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:50)
    ...
    org.jetbrains.exposed.JavaTimeBaseTest > javaTimeFunctions FAILED
        org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLFeatureNotSupportedException
        SQL: [Failed on expanding args for INSERT: org.jetbrains.exposed.sql.statements.InsertStatement@3f32f77b]
            at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:50)
    ...
    WARNING: An illegal reflective access operation has occurred
    WARNING: Illegal reflective access by net.snowflake.client.jdbc.internal.io.netty.util.internal.ReflectionUtil (file:/Users/dmitchell/.gradle/caches/modules-2/files-2.1/net.snowflake/snowflake-jdbc/3.12.7/e47fa73b85037285b887c63602f9c509df27b2be/snowflake-jdbc-3.12.7.jar) to constructor java.nio.DirectByteBuffer(long,int)
    WARNING: Please consider reporting this to the maintainers of net.snowflake.client.jdbc.internal.io.netty.util.internal.ReflectionUtil
    WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
    WARNING: All illegal access operations will be denied in a future release
    • 1
    • 2
Powered by Linen
Title
d

Don Mitchell

06/29/2020, 2:03 PM
I'm writing a Snowflake dialect for exposed. The good news is that 11/19 tests pass 🙂 If you're interested in this work, my fork and branch https://github.com/dmitchell/Exposed/tree/snowflake. I'd welcome critiques and help. Right now, it's failing on the prepared statements where somehow the values are not properly going to the payload.
org.jetbrains.exposed.JavaTimeBaseTest > javaTimeFunctions STANDARD_OUT
    20:41:39,049  WARN Test worker Exposed:invoke:183 - Transaction attempt #0 failed: java.sql.SQLFeatureNotSupportedException. Statement(s): INSERT INTO CITIESTIME (LOCAL_TIME, "NAME") VALUES (?, ?)
    org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLFeatureNotSupportedException
    SQL: [INSERT INTO CITIESTIME (LOCAL_TIME, "NAME") VALUES (?, ?)]
        at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:50)
...
org.jetbrains.exposed.JavaTimeBaseTest > javaTimeFunctions FAILED
    org.jetbrains.exposed.exceptions.ExposedSQLException: java.sql.SQLFeatureNotSupportedException
    SQL: [Failed on expanding args for INSERT: org.jetbrains.exposed.sql.statements.InsertStatement@3f32f77b]
        at org.jetbrains.exposed.sql.statements.Statement.executeIn$exposed_core(Statement.kt:50)
...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.snowflake.client.jdbc.internal.io.netty.util.internal.ReflectionUtil (file:/Users/dmitchell/.gradle/caches/modules-2/files-2.1/net.snowflake/snowflake-jdbc/3.12.7/e47fa73b85037285b887c63602f9c509df27b2be/snowflake-jdbc-3.12.7.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of net.snowflake.client.jdbc.internal.io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
btw: re convo in https://github.com/Tapac/exposed-wiki/pull/6#issuecomment-651028163 • I'll check w snowflake re getting a db accessible for exposed testing. I can see a lot of reasons they'd be reluctant (abuse potentials, but) • thanks for the pointer to the methods for indexes. I hadn't found them yet. • the byte issue ends up being a bug in jdbc.snowflake which I've patched but I've also written a guard in exposed to avoid https://github.com/snowflakedb/snowflake-jdbc/pull/271 • thanks for the current timestamp pointer, I'd fixed that but there seems several alt code paths which don't pick it up. I think I've got them.
Can the authorities for exposed sign up for a trial snowflake account https://trial.snowflake.com/ so that the unit tests will work for others (I'm testing against my company's non-public account)
👀 1
View count: 12