Exposed DAO Extensions
Latest stable Based on Exposed release 1.11.0
Identity, string-ID, generated-ID, and audit conventions for Exposed DAO entities.
Problem
Section titled “Problem”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.
When to use it
Section titled “When to use it”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.
Coordinates
Section titled “Coordinates”io.github.bluetape4k.exposed:bluetape4k-exposed-dao, managed by io.github.bluetape4k:bluetape4k-dependencies:<version>.
Core concepts
Section titled “Core concepts”idEquals,idHashCode, and entity string builders make identity handling explicit.StringEntityand generated-ID entity families pair with core ID tables.AuditableEntitysets actor fields, butupdatedAtis guaranteed only by audited JDBC repository updates.- A DAO entity remains attached to the active Exposed transaction.
Quick start
Section titled “Quick start”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.
API by task
Section titled “API by task”| Task | API |
|---|---|
| Identity equality/hash | idEquals, idHashCode |
| Diagnostic text | toStringBuilder, entityToStringBuilder |
| String IDs | StringEntity, StringEntityClass |
| Generated IDs | KSUID, ULID, Snowflake, time-based UUID entity families |
| Audit actor fields | AuditableEntity and typed variants |
Recommended patterns
Section titled “Recommended patterns”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.
Integrations
Section titled “Integrations”DAO builds on core and Exposed DAO, with JDBC available at runtime. The JDBC repository module can share the same table declarations.
Configuration
Section titled “Configuration”No standalone configuration exists. Configure Exposed’s database/transaction layer and bind UserContext where audit actor fields are needed.
Failure modes
Section titled “Failure modes”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.
Operations
Section titled “Operations”Keep transaction duration bounded and avoid logging lazy properties that trigger unexpected queries. Monitor query count when traversing relations.
Testing
Section titled “Testing”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.
Workshops and learning path
Section titled “Workshops and learning path”Read Mapping conventions, then choose the JDBC repository path. Exposed DAO is not the R2DBC entity model.
Limitations
Section titled “Limitations”This module does not make DAO entities detached, reactive, or safe outside a transaction. It does not own transaction creation.
Release diagrams
Section titled “Release diagrams”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
Section titled “AuditableEntity UML Class Diagram”Release README: exposed/dao/README.md
Generated-ID DAO Support Matrix
Section titled “Generated-ID DAO Support Matrix”Release README: exposed/dao/README.md
Entity Helper Pairing Map
Section titled “Entity Helper Pairing Map”Release README: exposed/dao/README.md
Automatic field assignment diagram
Section titled “Automatic field assignment diagram”Release README: exposed/dao/README.md



