Exposed Core Library
Latest stable Based on Exposed release 1.11.0
Shared table, identifier, result mapping, audit, paging, and column-type primitives for both JDBC and R2DBC paths.
Problem
Section titled “Problem”Exposed supplies its DSL and table model. Production projects still repeat generated-ID declarations, ResultRow conversions, paging values, audit columns, soft-delete flags, and specialized column types. This module centralizes those cross-runtime conventions without opening a database connection or transaction.
When to use it
Section titled “When to use it”Use it as the common foundation for bluetape4k-exposed-jdbc or bluetape4k-exposed-r2dbc. It is also useful when a shared schema module must compile independently of the final driver path.
Coordinates
Section titled “Coordinates”dependencies { implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>")) implementation("io.github.bluetape4k.exposed:bluetape4k-exposed-core")}Core concepts
Section titled “Core concepts”- ID table families use client-side generators through
clientDefault. ExposedPagecarries page metadata and content; repositoryfindPageobtains count and content separately.AuditableIdTablefillscreatedByon insert. Only audited repository update methods guaranteeupdatedAtandupdatedBy.UserContextresolvesScopedValue, then thread-local state, thensystem.- Soft delete is a table convention; ordinary repository reads do not silently filter deleted rows.
Quick start
Section titled “Quick start”object Events : UlidTable("events") { val payload = varchar("payload", 400)}The generated value is a client default, so application code can build an insert without delegating ID generation to a database sequence.
API by task
Section titled “API by task”| Task | Stable 1.11 API |
|---|---|
| Generated IDs | KsuidTable, KsuidMillisTable, UlidTable, SnowflakeIdTable, TimebasedUUIDTable |
| Soft-delete schema | SoftDeletedIdTable |
| Audit schema/context | AuditableIdTable, AuditableIntIdTable, AuditableLongIdTable, AuditableUUIDTable, UserContext |
| Paging value | ExposedPage |
| Row/column helpers | ResultRowExtensions, ColumnExtensions, ExposedColumnSupports |
| Specialized data | compressed, serialized, INET, phone, and blob column helpers |
Recommended patterns
Section titled “Recommended patterns”Keep table declarations and pure row mappers in a shared persistence model. Let a service or framework transaction boundary choose JDBC or R2DBC. Use one ID strategy per aggregate and record its ordering and storage properties in the schema decision.
Integrations
Section titled “Integrations”The JDBC, R2DBC, DAO, serialization, measurement, cache, and database-adapter modules build on this foundation. Optional column types require their corresponding runtime libraries.
Configuration
Section titled “Configuration”Core has no connection configuration. Configure ID generators and optional codecs in application code, and bind UserContext at the request or job boundary.
Failure modes
Section titled “Failure modes”- Reading a generated ID as database-generated can produce wrong migration assumptions.
- Calling a generic update on an auditable table does not populate the audited update fields.
- Relying on thread-local user state across coroutine dispatcher hops loses context; use
withCoroutineUser/asContextElement. - Treating
findPagecount and content as one snapshot is unsafe unless the surrounding transaction/isolation supplies that guarantee.
Operations
Section titled “Operations”Persist audit timestamps in UTC, inspect ID index locality for high-write tables, and make soft-delete retention/purge an explicit operational policy.
Testing
Section titled “Testing”Test table defaults against the actual dialects you deploy. The repository uses JDBC test support for core integration tests, including H2, MariaDB, MySQL, PostgreSQL, and pgjdbc-ng coverage where applicable.
Workshops and learning path
Section titled “Workshops and learning path”Read Entity and ID model and Mapping conventions, then continue to transaction boundaries.
Limitations
Section titled “Limitations”Core does not own transactions, connections, Spring beans, driver selection, or repository lifecycle. Release 1.11 documentation must not rely on later develop-only DDD APIs.
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.
Auditable UML Class Diagram
Section titled “Auditable UML Class Diagram”Release README: exposed/core/README.md
Column Type Pipeline Map
Section titled “Column Type Pipeline Map”Release README: exposed/core/README.md
IdTable Selection Matrix
Section titled “IdTable Selection Matrix”Release README: exposed/core/README.md
ExposedPage Data Model
Section titled “ExposedPage Data Model”Release README: exposed/core/README.md
UserContext — Managing the Current User diagram
Section titled “UserContext — Managing the Current User diagram”Release README: exposed/core/README.md




