Skip to content

#2540 Add DTO mapping from Entity beans via generated mapper code#3852

Merged
rbygrave merged 3 commits into
masterfrom
mapping
Jul 15, 2026
Merged

#2540 Add DTO mapping from Entity beans via generated mapper code#3852
rbygrave merged 3 commits into
masterfrom
mapping

Conversation

@rbygrave

Copy link
Copy Markdown
Member

A large feature, refer to the docs / guides etc. This is a bit like MapStruct in that it generates mapping code via annotation processing but it ALSO creates an optimised FetchGroup for the destination DTO graph and it also implements a generic interface such that it can be fluently used via query.mapTo().

The value is that it automates the mapping code from entity -> dto plus optimises the query used to support building the DTO graph.

Expected to be better to use than MapStruct for ebean orm users.

The general expectation is a Contract-First set of DTO objects (Java records, possibly with automatic builders). These DTO's are plain, not modifiable, no tie to any framework.

We desire to perform an ebean orm query for a given entity bean and have that "mapped" to a give DTO type. The mapping code from entity -> dto is source code generated via annotation processor (querybean-generator). In addition to the mapping code a FetchGroup to fetch the needed properties is also built and will automatically be applied to the query thus optimising the query for the given dto being returned.

A large feature, refer to the docs / guides etc. This is a bit like MapStruct in that it generates mapping code via annotation processing but it ALSO creates an optimised FetchGroup for the destination DTO graph and it also implements a generic interface such that it can be fluently used via query.mapTo().

The value is that it automates the mapping code from entity -> dto plus optimises the query used to support building the DTO graph.

Expected to be better to use than MapStruct for ebean orm users.
@rbygrave rbygrave added this to the 18.3.0 milestone Jul 15, 2026
@rbygrave rbygrave self-assigned this Jul 15, 2026
@rbygrave rbygrave merged commit 636bb28 into master Jul 15, 2026
1 check passed
@rbygrave rbygrave deleted the mapping branch July 15, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants