DEV Community

Mohamed Shaban
Mohamed Shaban

Posted on • Originally published at robovai.tech

Exposed 1.0: A Major Milestone for the Kotlin SQL Framework

Exposed 1.0: A Major Milestone for the Kotlin SQL Framework

The Exposed team is thrilled to announce the release of Exposed 1.0, a significant milestone for the Kotlin SQL framework. This major release brings numerous exciting features, performance enhancements, and bug fixes, making it a must-have for Kotlin developers working with databases. In this article, we'll dive into the details of Exposed 1.0 and explore its new features, improvements, and best practices.

What's New in Exposed 1.0?

Exposed 1.0 is the result of extensive development and community feedback. The most notable feature in this release is the addition of R2DBC support. R2DBC (Reactive Relational Database Connectivity) is a reactive database connectivity specification that allows for non-blocking, asynchronous database interactions. With Exposed 1.0, developers can now leverage R2DBC to build more responsive and scalable applications.

R2DBC Support

To use R2DBC with Exposed 1.0, you'll need to add the exposed-r2dbc module to your project. Here's an example of how to do this in Gradle:

dependencies {
    implementation 'org.jetbrains.exposed:exposed-r2dbc:1.0.0'
}
Enter fullscreen mode Exit fullscreen mode

With R2DBC support, you can now write reactive database code using Exposed's familiar API. Here's an example of how to perform a simple query using R2DBC:

import org.jetbrains.exposed.r2dbc.R2dbcDatabase
import org.jetbrains.exposed.sql.select

// Create an R2DBC database instance
val database = R2dbcDatabase.connect("r2dbc:postgresql://localhost:5432/mydb", "username", "password")

// Perform a query using Exposed's DSL
database.transaction {
    val results = Users.select { Users.name eq "John" }.toList()
    results.forEach { println(it[Users.name]) }
}
Enter fullscreen mode Exit fullscreen mode

Performance Enhancements

Exposed 1.0 also brings significant performance improvements, particularly in the areas of query generation and database interaction. These enhancements result in faster and more efficient database operations, making your applications more responsive and scalable.

Improved Query Generation

Exposed's query generation has been optimized to reduce the number of database queries and improve overall performance. Here's an example of how Exposed's DSL can be used to generate efficient queries:

import org.jetbrains.exposed.sql.select
import org.jetbrains.exposed.sql.join

// Define two tables
object Users : Table() {
    val id = integer("id").autoIncrement().primaryKey()
    val name = varchar("name", 255)
}

object Orders : Table() {
    val id = integer("id").autoIncrement().primaryKey()
    val userId = integer("user_id").references(Users.id)
}

// Perform a join using Exposed's DSL
val results = Users.join(Orders, JoinType.INNER, Users.id, Orders.userId)
    .select { Users.name eq "John" }
    .toList()
Enter fullscreen mode Exit fullscreen mode

Bug Fixes and Stability Improvements

Exposed 1.0 includes numerous bug fixes and stability improvements, ensuring a more reliable and robust database interaction experience. The Exposed team has worked tirelessly to address community feedback and fix issues reported by users.

Stable API

One of the most significant benefits of Exposed 1.0 is its stable API, which guarantees no breaking changes until the next major release. This stability provides developers with the confidence to build and maintain complex database-driven applications without worrying about API changes.

Key Takeaways

  • Exposed 1.0 brings R2DBC support, enabling reactive database interactions
  • Performance enhancements improve query generation and database interaction
  • Bug fixes and stability improvements ensure a more reliable experience
  • Stable API guarantees no breaking changes until the next major release

Best Practices for Using Exposed 1.0

To get the most out of Exposed 1.0, follow these best practices:

  • Use the R2DBC module for reactive database interactions
  • Optimize your queries using Exposed's DSL
  • Take advantage of Exposed's performance enhancements
  • Follow the Exposed documentation for the latest API usage guidelines

Conclusion

Exposed 1.0 is a significant milestone for the Kotlin SQL framework, bringing numerous exciting features, performance enhancements, and bug fixes. With its stable API and R2DBC support, Exposed 1.0 is an ideal choice for building complex database-driven applications. We encourage you to try Exposed 1.0 today and take advantage of its many benefits. For more information, please refer to the Exposed documentation and release notes.


🚀 Enjoyed this article?

If you found this helpful, here's how you can support:

💙 Engage

  • Like this post if it helped you
  • Comment with your thoughts or questions
  • Follow me for more tech content

📱 Stay Connected

🌍 Arabic Version

تفضل العربية؟ اقرأ المقال بالعربية:
https://www.robovai.tech/2026/01/exposed-10.html


Thanks for reading! See you in the next one. ✌️

Top comments (0)