check out `jdbi3-kotlin` and `jdbi3-kotlin-sqlobje...
# server
s
check out
jdbi3-kotlin
and
jdbi3-kotlin-sqlobject
if you aren’t deathly afraid of writing a bit of SQL
c
do you think its better than exposed? both seem very similar, jdbi is around longer but exposed is more kotliny
f
they're very different, exposed is closer to Hibernate, JDBI is more "JDBC with mapping to your objects"
c
exposed has a dsl and daos, but if you look only at the dsl it looks very much like jdbi
s
Exposed doesn’t seem to have a whole lot of documentation… can you provide an example of the comparison you’re trying to make?
like nothing here https://github.com/JetBrains/Exposed/wiki/DSL really resembles how I use JDBI
c
i looked at this tutorial https://medium.com/@wifekraissi/spring-boot-kotlin-data-access-be85d69d6657 (scroll down to part 2). and i assumed that jdbi is similar, in being more a sql based and not really a orm
f
well in JDBI you write the actual SQL, Exposed writes it for you (like Hibernate)
👆 1
c
ah really? even if you just want to fetch all fields from a table?
f
yup, no magic conversion from code to SQL
you'd do like
Copy code
val result = jdbi.createQuery("SELECT * FROM the_table").mapTo<TheClass>().list()
s
or using the declarative API you’d have something like
Copy code
interface ThingDao {
  @SqlQuery("SELECT * FROM the_table")
  fun getThings(): List<Thing>
}
with a corresponding bit of code to tell JDBI to generate the DAO implementation
m
JDBI seems very similar to MyBatis, although MyBatis did create a Java Builder style DSL for defining the queries if you want to move away from String templating.
140 Views