Skip to content
Exposed docs1.11

Exposed DAO Extensions

Latest stable Based on Exposed release 1.11.0

Identity, string-ID, generated-ID, and audit conventions for Exposed DAO entities.

Exposed DAO entities are transaction-bound objects. Equality, string rendering, generated-ID entity classes, and audit updates are easy to implement inconsistently. This module provides a small shared convention layer above Exposed DAO.

Use it when the domain persistence model intentionally uses Exposed Entity/EntityClass. Prefer record/DTO mapping through the JDBC or R2DBC repositories when values must leave the transaction boundary.

io.github.bluetape4k.exposed:bluetape4k-exposed-dao, managed by io.github.bluetape4k:bluetape4k-dependencies:<version>.

  • idEquals, idHashCode, and entity string builders make identity handling explicit.
  • StringEntity and generated-ID entity families pair with core ID tables.
  • AuditableEntity sets actor fields, but updatedAt is guaranteed only by audited JDBC repository updates.
  • A DAO entity remains attached to the active Exposed transaction.
class Customer(id: EntityID<String>) : StringEntity(id) {
companion object : StringEntityClass<Customer>(Customers)
var name by Customers.name
}

Read lazy relations and convert the entity to a detached DTO before the transaction closes.

TaskAPI
Identity equality/hashidEquals, idHashCode
Diagnostic texttoStringBuilder, entityToStringBuilder
String IDsStringEntity, StringEntityClass
Generated IDsKSUID, ULID, Snowflake, time-based UUID entity families
Audit actor fieldsAuditableEntity and typed variants

Keep DAO access and lazy traversal inside one caller-owned JDBC transaction. Map to immutable output values at that boundary. Avoid returning an Entity from a service and touching it later.

DAO builds on core and Exposed DAO, with JDBC available at runtime. The JDBC repository module can share the same table declarations.

No standalone configuration exists. Configure Exposed’s database/transaction layer and bind UserContext where audit actor fields are needed.

Detached/lazy access can fail after the transaction closes. Generic entity updates do not guarantee updatedAt. Identity comparison before an entity has a stable ID must be treated carefully.

Keep transaction duration bounded and avoid logging lazy properties that trigger unexpected queries. Monitor query count when traversing relations.

Use a real transaction and database fixture. Assert detached DTO values after mapping, audit actor behavior, and ID-family persistence across the dialects you support.

Read Mapping conventions, then choose the JDBC repository path. Exposed DAO is not the R2DBC entity model.

This module does not make DAO entities detached, reactive, or safe outside a transaction. It does not own transaction creation.

These diagrams are loaded directly from README assets published with the 1.11.0 release and pinned to its immutable commit. They describe this manual’s released structure and runtime flows, not later Snapshot changes. Select a preview to open the SVG at the same release commit.

AuditableEntity UML Class Diagram

Release README: exposed/dao/README.md

Generated-ID DAO Support Matrix

Release README: exposed/dao/README.md

Entity Helper Pairing Map

Release README: exposed/dao/README.md

Automatic field assignment diagram

Release README: exposed/dao/README.md