https://kotlinlang.org logo
#exposed
Title
# exposed
n

nilTheDev

10/21/2021, 4:31 PM
Okay here is my short experience with Exposed. I was thinking of developing a REST api with ktor. Ktor's documentations are awesome. It took me little time to get started. Connecting to a database is also a crucial part for developing an api. A quick search landed me on the Exposed page. There were nothing but a bunch of code in the README file. I understand Exposed has not even reached version 1, so I am not blaming it. All experience in regard to database connection I had was just using the sqlite library in python and executing bare sql queries. I was blown up with all the new terms like ORM, DAO, Hikari and so on. Tutorials wasn't helpful either. I was frustrated and overwhelmed. Then I tried to find what people use with Java. A name Hibernate popped out. I went on the docs. And fortunately it pointed me to a great article that pointed me to another one. Now, finally I am getting it. The bare SQL version for the JVM world is JDBC. And there are stable libraries other than exposed. Like JPA, Hibernate, JOOQ. I am finally able to connect to my database and run sql queries (using JDBC though 😅). I would look into some lightweight stable libraries other than Exposed as of now. Once I get comfortable with accessing databases, only then I would look into Exposed. This database thing became an ugly nightmare to me. Finally I will be sleeping peacefully tonight. 🙃
m

maxmello

10/22/2021, 8:49 AM
There is additional documentation in the wiki for Exposed: https://github.com/JetBrains/Exposed/wiki
n

nilTheDev

10/22/2021, 9:04 AM
I saw that. But because of the lack of basic JDBC skills I was struggling to make the connection with my database.
m

maxmello

10/22/2021, 9:33 AM
Ah okay, just wanted to make sure. I think the use case for Exposed and other libraries really only starts once someone has basic to medium understanding of SQL itself and then some in using plain queries as they are shown in the first link you posted. Using something like Exposed, where a SQL queries are “hidden” behind Kotlin functions, a table can be defined through a class etc. adds additional abstraction which is nice once you know how to use it, but in your case, Exposed might just not be the right tool (yet). I wouldn’t say that is because Exposed is not 1.0 yet, but because it is by design an abstraction layer above SQL that is only useful if you understand the lower level first.
25 Views