Skip to content

DTOs and Entities

CrudCraft separates persistence entities from transport-layer DTOs to enforce clear boundaries.

Entities

Entities are JPA-managed classes representing your database schema. Annotate them with @CrudCrafted and JPA mappings.

DTOs

DTOs are generated based on @Dto and @Request annotations. Response DTOs expose data to clients while request DTOs capture input.

Reference DTOs

Set ref = true on @Dto to include a field on lightweight reference DTOs used in relationships.

This separation keeps your domain model decoupled from external APIs and prevents leaking internal state.