Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Projection section in reference documentation. #3449

Closed
wants to merge 2 commits into from

Conversation

christophstrobl
Copy link
Member

For the time being we at least now document the current behaviour and how to cope with it.

See: #3286

[NOTE]
====
Some JPA providers may require additional hints when working with <<projections.dtos,Class-based projections>> especially when using those directly with method derived queries.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That confuses me. @PersistenceCreator is a Spring Data annotation, I'm sure that JPA providers don't care about that.

I would expect that the situation is more: We need either a constructor taking all the properties as arguments and if it isn't the only constructor we need it to be marked with @PersistenceCreator.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's our code that determines input properties. We use our mechanism to discover whether there is a preferred constructor and the properties it takes.

[NOTE]
====
Some JPA providers may require additional hints when working with <<projections.dtos,Class-based projections>> especially when using those directly with method derived queries.
If you are facing errors like `JpaSystemException: Specified result type did not match Query selection type` make sure to provide a constructor hint via `@PersistenceCreator` to be passed on, as outlined below:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't so much outlined below but demonstrated, isn't it?

@schauder schauder assigned christophstrobl and unassigned schauder May 6, 2024
@mp911de mp911de force-pushed the main branch 2 times, most recently from 52ee55f to 61e6d36 Compare October 9, 2024 07:35
@mp911de mp911de added the type: documentation A documentation update label Dec 3, 2024
@mp911de mp911de added this to the 3.3.7 (2024.0.7) milestone Dec 3, 2024
mp911de pushed a commit that referenced this pull request Dec 3, 2024
For the time being we at least now document the current behaviour and how to cope with it.

Closes: #3286
Original pull request: #3449
mp911de added a commit that referenced this pull request Dec 3, 2024
Tweak wording.

See: #3286
Original pull request: #3449
mp911de pushed a commit that referenced this pull request Dec 3, 2024
For the time being we at least now document the current behaviour and how to cope with it.

Closes: #3286
Original pull request: #3449
mp911de added a commit that referenced this pull request Dec 3, 2024
Tweak wording.

See: #3286
Original pull request: #3449
mp911de pushed a commit that referenced this pull request Dec 3, 2024
For the time being we at least now document the current behaviour and how to cope with it.

Closes: #3286
Original pull request: #3449
mp911de added a commit that referenced this pull request Dec 3, 2024
Tweak wording.

See: #3286
Original pull request: #3449
@mp911de mp911de closed this Dec 3, 2024
@mp911de mp911de deleted the issue/3286 branch December 3, 2024 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QueryTypeMismatchException if the DTO has a no-args constructor
3 participants