Back to Examples
Mapping tables to entities
Learn how Litebridge maps relational database tables to Java records, plain DTOs, and annotated entity classes.
Mapping Strategies
Litebridge provides flexible persistence modeling without requiring domain classes to inherit from framework-specific base classes. There are two primary approaches to entity registration:
Annotated Entities
Decorate domain classes using Litebridge annotations like @Tableand @Column. Entities can be registered individually or scanned automatically from packages.
Programmatic DTOs
Map plain unannotated DTOs and Java records via Litebridge's fluent registration API, separating database schema details completely from domain models.