Modules
Last modified: 03 March 2025Exposed is split into specific modules that give you the flexibility to only use the modules you need. In this topic you'll learn what these modules are and how to add module dependencies to an existing Gradle/Maven project.
Configure the repository
Exposed modules are available from the Maven Central repository. To use them, add the appropriate dependency into your repositories mapping:
repositories {
mavenCentral()
}
The Maven Central repository is enabled by default for Maven users.
repositories {
mavenCentral()
}
Add Exposed dependencies
Exposed consists of multiple modules that we've split into two categories:
Core modules
To use Exposed in your application you need the following core modules:
Module | Function |
---|---|
| Provides the foundational components and abstractions needed to work with databases in a type-safe manner and includes the Domain-Specific Language (DSL) API |
| (Optional) Allows you to work with the Data Access Object (DAO) API |
| Provides support for Java Database Connectivity (JDBC) with a transport-level implementation based on the Java JDBC API |
Add the required Exposed modules to your project's dependencies:
dependencies {
implementation("org.jetbrains.exposed:exposed-core:0.60.0")
implementation("org.jetbrains.exposed:exposed-jdbc:0.60.0")
implementation("org.jetbrains.exposed:exposed-dao:0.60.0") // Optional
}
<dependencies>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-core</artifactId>
<version>0.60.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-jdbc</artifactId>
<version>0.60.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.exposed</groupId>
<artifactId>exposed-dao</artifactId>
<version>0.60.0</version>
</dependency>
</dependencies>
dependencies {
implementation "org.jetbrains.exposed:exposed-core:0.60.0"
implementation "org.jetbrains.exposed:exposed-jdbc:0.60.0"
implementation "org.jetbrains.exposed:exposed-dao:0.60.0" //optional
}
Extension modules
The following modules extend Exposed's capabilities, allowing you to work with specific data types, encryption, and date-time handling:
Module | Function |
---|---|
| Provides additional column types to store encrypted data in the database and encode/decode it on the client-side |
| Date-time extensions based on the Java 8 Time API |
| Date-time extensions based on the Joda-Time library |
| JSON and JSONB data type extensions |
| Date-time extensions based on the |
| Extensions to support |
| A starter for Spring Boot to utilize Exposed as the ORM instead of Hibernate |
| Transaction manager that builds on top of Spring's standard transaction workflow |
| Provides utilities to support database schema migrations |
Add a JDBC driver
You also need a JDBC driver for the database system you are using. For example, the following dependency adds a JDBC driver for the H2 database:
dependencies {
implementation("com.h2database:h2:2.2.224")
}
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.224</version>
</dependency>
</dependencies>
dependencies {
implementation "com.h2database:h2:2.2.224"
}
tip
For the complete list of supported databases and their corresponding driver dependency, see Working with Databases.
Add a logging dependency
To be able to see logs from StdOutSqlLogger
, add a logging dependency:
dependencies {
implementation("org.slf4j:slf4j-nop:1.7.30")
}
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>
dependencies {
implementation "org.slf4j:slf4j-nop:1.7.30"
}
tip
For more information on why a logging dependency is needed, see the SLF4J Documentation.