Update Projection section in reference documentation.

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

Closes: #3286
Original pull request: #3449
This commit is contained in:
Christoph Strobl
2024-04-26 15:58:28 +02:00
committed by Mark Paluch
parent becdf40b17
commit 7bcc96d84b

View File

@@ -15,3 +15,28 @@ include::{commons}@data-commons::page$repositories/projections-interface.adoc[le
include::{commons}@data-commons::page$repositories/projections-class.adoc[leveloffset=1]
[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:
[source,java]
----
public class NamesOnly {
private final String firstname;
private final String lastname;
protected NamesOnly() { }
@PersistenceCreator
public NamesOnly(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
// ...
}
----
====