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
komapper
  • d

    dave08

    12/13/2022, 3:01 PM
    Although I understand that the schema creator is for testing purposes only, but having indexes there is really part of testing...
  • d

    dave08

    12/13/2022, 3:01 PM
    Especially when things need to be unique.
  • d

    dave08

    12/13/2022, 4:26 PM
    Another little point: https://kotlinlang.slack.com/archives/C0B8MA7FA/p1670948659497899?thread_ts=1670947765.725889&cid=C0B8MA7FA
    t
    • 2
    • 27
  • d

    dave08

    12/13/2022, 4:37 PM
    It seems like there's also no way to make an entity without an id... the problem comes up in many-to-many linker tables... they only have two foreign keys, but no primary id key.
    t
    l
    • 3
    • 22
  • d

    dave08

    12/26/2022, 10:31 AM
    Is this planned? https://kotlinlang.slack.com/archives/C03JF82SDHA/p1671020954788009?thread_ts=1670948761.293189&cid=C03JF82SDHA ... the way it is now in our code isn't too nice, it would have been nice to support more than just the first param, but if that's what you think is the clearest way to express this, then it's certainly better than nothing!
    t
    • 2
    • 4
  • d

    dave08

    12/26/2022, 2:10 PM
    Can a field in an Entity be private?
    t
    • 2
    • 3
  • t

    Toshihiro Nakamura

    12/29/2022, 3:03 AM
    Hi, everyone. We have confirmed that Komapper works with Kotlin 1.8.0 and have updated the compatibility matrix. https://github.com/komapper/komapper#compatibility-matrix
  • d

    dave08

    01/02/2023, 12:28 PM
    @Toshihiro Nakamura Are you putting out a new release with the recent changes soon?
    t
    • 2
    • 1
  • d

    dave08

    01/03/2023, 5:01 PM
    I think the
    EntityStore
    would have been better if they were generated and defined ONCE and not just when trying to retrieve data... one can easily make a mistake and use the wrong thing as the one and the many... when declaring the entities and relations, we tend to check the db structures and make sure the relations are right, from then on, the querying should only give the RIGHT options for the situation...
    t
    • 2
    • 8
  • d

    dave08

    01/03/2023, 5:03 PM
    Also, it would be nice to have support for mapping to DTOs using annotations (not the entities themselves)... maybe that's an opportunity to rethink EntityStore for this too...
    t
    • 2
    • 5
  • t

    Toshihiro Nakamura

    01/07/2023, 3:48 AM
    Hi, everyone. Komapper v1.6.0 is out! This version includes feedback from our users. Thank you for your cooperation. Please give it a try. https://github.com/komapper/komapper/releases/tag/v1.6.0
  • d

    dave08

    01/10/2023, 11:32 AM
    Hi @Toshihiro Nakamura! Is there any way to SAVE to a json field in mysql using komapper? (I don't really need to read from it for now...)
  • d

    dave08

    01/10/2023, 11:37 AM
    Will it work if I just use a
    String
    field?
  • d

    dave08

    01/10/2023, 11:46 AM
    In the R2dbc driver it says that json is supported using
    String
    ... does that mean that it's also supported by Komapper?
    t
    • 2
    • 25
  • d

    dave08

    01/10/2023, 11:47 AM
    https://github.com/mirromutth/r2dbc-mysql#data-type-mapping
  • d

    dave08

    01/11/2023, 1:12 PM
    It seems like not all kinds of subqueries are supported... so my only choice is using templates in that case?
    t
    • 2
    • 1
  • d

    dave08

    01/11/2023, 1:13 PM
    It would have still been nice to have some kind of mixture... using some kind of template together with already generated Meta objects for mapping results or binding fields...
    t
    • 2
    • 3
  • d

    dave08

    01/11/2023, 1:14 PM
    That way part of the run time errors can be avoided.
  • d

    dave08

    01/12/2023, 2:23 PM
    Boy @Toshihiro Nakamura, it's not so pleasant working with r2dbc CLOBs... on one hand, I need a Mysql LongText field, on the other it would have been MUCH easier to work with it as a Kotlin String...
  • d

    dave08

    01/12/2023, 2:24 PM
    And anyways, it might break my jdbc to r2dbc adapter, since jdbc return java.sql.clob and r2dbc returns something else...
  • d

    dave08

    01/12/2023, 2:26 PM
    It would have been great if
    @KomapperColumn
    would receive an extra parameter that allows to hard code the db type w/o inducing it from the field type...
  • d

    dave08

    01/12/2023, 2:39 PM
    Even java.sql.Clob is just an interface... so for unit testing, I'd have to selectively use the h2 or mysql implementation, depending on which I want to run tests against, and I'd need to instanciate it to create fake data... for that, you need a connection and other things...!
  • d

    dave08

    01/12/2023, 2:41 PM
    It would be MUCH nicer if all this could somehow be abstracted unless the user REALLY needs to deal with very large data stored in such a field -- in my case, I just need more than 255 characters, but NOT that much to have to go through the extra boilerplate code needed for Clob...
  • d

    dave08

    01/12/2023, 4:45 PM
    I ended up writing my own data type that gets the clob as a string... but what about having a data type that depends on an annotation instead of a new class? Say:
    @KomapperEntity
    data class FooEntity(@KomapperType(ClobStringType::class) val sometext: String)
    t
    • 2
    • 5
  • s

    S.

    01/13/2023, 2:58 PM
    What exactly is
    returnGeneratedKeys
    from the options here
    onDuplicateKeyUpdate().multiple().options
    supposed to do? The query still returns a single Long value. Essentially I'm trying to bulk insert and retrieve all IDs with postgresql
    t
    • 2
    • 9
  • t

    Toshihiro Nakamura

    01/15/2023, 4:40 AM
    Hi, everyone. Komapper v1.6.1 is out. We support MariaDB R2DBC and MySQL R2DBC from this version. Please give it a try. https://github.com/komapper/komapper/releases/tag/v1.6.1
    d
    • 2
    • 90
  • z

    zt

    01/15/2023, 4:59 AM
    Hi, I haven't been able to find anything on this but how would I set up relations? Like I wanna have a
    Guild
    object that has a
    MarkovConfig
    t
    d
    • 3
    • 25
  • d

    dave08

    01/15/2023, 1:41 PM
    It might also be nice to generate a list or set of all of the contents of each Meta object in the Meta object. Often one would like to just create or drop all the tables in tests, and manually managing such a list is a bit error prone and extra boilerplate.
    t
    • 2
    • 17
  • d

    dave08

    01/15/2023, 1:41 PM
    Maybe like
    Meta.all
    or
    Meta.allEntities
    ?
  • d

    dave08

    01/17/2023, 11:27 AM
    Is there any way to use an existing Jasync connection to start a R2dbc komapper connection? We have a service we want to gradually migrate to Komapper and we don't want to have an extra connection pool open to the databases...
    t
    • 2
    • 5
Powered by Linen
Title
d

dave08

01/17/2023, 11:27 AM
Is there any way to use an existing Jasync connection to start a R2dbc komapper connection? We have a service we want to gradually migrate to Komapper and we don't want to have an extra connection pool open to the databases...
t

Toshihiro Nakamura

01/17/2023, 11:52 AM
Try to wrap your existing connection with ConnectionFactory:
val connectionFactory = object : ConnectionFactory {
    override fun create(): Publisher<out Connection> {
        // return existing connection
    }

    override fun getMetadata(): ConnectionFactoryMetadata {
        // ...
    }
}
val db = R2dbcDatabase(connectionFactory, H2R2dbcDialect())
d

dave08

01/17/2023, 11:54 AM
How do I do this with a JASync connection? (I'm really not too familiar with r2dbc api, and the docs are almost inexistant...)
t

Toshihiro Nakamura

01/17/2023, 12:04 PM
I am not familiar with JASync; doesn’t JASync Connection provide io.r2dbc.spi.Connection? You can convert io.r2dbc.spi.Connection to Publisher<out Connection> as followings:
flowOf(connection).asPublisher()
d

dave08

01/17/2023, 12:05 PM
https://github.com/jasync-sql/jasync-sql/wiki/Configuring-and-Managing-Connections
It has it's own connection object w/o r2dbc
View count: 4