Skip to content
Exposed docs1.11

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.

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.

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.

dependencies {
implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>"))
implementation("io.github.bluetape4k.exposed:bluetape4k-exposed-core")
}
  • ID table families use client-side generators through clientDefault.
  • ExposedPage carries page metadata and content; repository findPage obtains count and content separately.
  • AuditableIdTable fills createdBy on insert. Only audited repository update methods guarantee updatedAt and updatedBy.
  • UserContext resolves ScopedValue, then thread-local state, then system.
  • Soft delete is a table convention; ordinary repository reads do not silently filter deleted rows.
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.

TaskStable 1.11 API
Generated IDsKsuidTable, KsuidMillisTable, UlidTable, SnowflakeIdTable, TimebasedUUIDTable
Soft-delete schemaSoftDeletedIdTable
Audit schema/contextAuditableIdTable, AuditableIntIdTable, AuditableLongIdTable, AuditableUUIDTable, UserContext
Paging valueExposedPage
Row/column helpersResultRowExtensions, ColumnExtensions, ExposedColumnSupports
Specialized datacompressed, serialized, INET, phone, and blob column helpers

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.

The JDBC, R2DBC, DAO, serialization, measurement, cache, and database-adapter modules build on this foundation. Optional column types require their corresponding runtime libraries.

Core has no connection configuration. Configure ID generators and optional codecs in application code, and bind UserContext at the request or job boundary.

  • 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 findPage count and content as one snapshot is unsafe unless the surrounding transaction/isolation supplies that guarantee.

Persist audit timestamps in UTC, inspect ID index locality for high-write tables, and make soft-delete retention/purge an explicit operational policy.

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.

Read Entity and ID model and Mapping conventions, then continue to transaction boundaries.

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.

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

Release README: exposed/core/README.md

Column Type Pipeline Map

Release README: exposed/core/README.md

IdTable Selection Matrix

Release README: exposed/core/README.md

ExposedPage Data Model

Release README: exposed/core/README.md

UserContext — Managing the Current User diagram

Section titled “UserContext — Managing the Current User diagram”

UserContext — Managing the Current User diagram

Release README: exposed/core/README.md