Title
s

Shawn

11/13/2018, 3:34 PM
check out
jdbi3-kotlin
and
jdbi3-kotlin-sqlobject
if you aren’t deathly afraid of writing a bit of SQL
c

christophsturm

11/13/2018, 3:35 PM
do you think its better than exposed? both seem very similar, jdbi is around longer but exposed is more kotliny
f

fred.deschenes

11/13/2018, 3:35 PM
they're very different, exposed is closer to Hibernate, JDBI is more "JDBC with mapping to your objects"
c

christophsturm

11/13/2018, 3:36 PM
exposed has a dsl and daos, but if you look only at the dsl it looks very much like jdbi
s

Shawn

11/13/2018, 3:38 PM
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

christophsturm

11/13/2018, 3:42 PM
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

fred.deschenes

11/13/2018, 3:45 PM
well in JDBI you write the actual SQL, Exposed writes it for you (like Hibernate)
👆 1
c

christophsturm

11/13/2018, 3:50 PM
ah really? even if you just want to fetch all fields from a table?
f

fred.deschenes

11/13/2018, 3:51 PM
yup, no magic conversion from code to SQL
you'd do like
val result = jdbi.createQuery("SELECT * FROM the_table").mapTo<TheClass>().list()
s

Shawn

11/13/2018, 3:57 PM
or using the declarative API you’d have something like
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

Mike

11/13/2018, 4:11 PM
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.