From 7bcc96d84be802872052acc1b7b141d2fd1657e8 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Fri, 26 Apr 2024 15:58:28 +0200 Subject: [PATCH] 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 --- .../ROOT/pages/repositories/projections.adoc | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/antora/modules/ROOT/pages/repositories/projections.adoc b/src/main/antora/modules/ROOT/pages/repositories/projections.adoc index 556eebe91..04ad285e4 100644 --- a/src/main/antora/modules/ROOT/pages/repositories/projections.adoc +++ b/src/main/antora/modules/ROOT/pages/repositories/projections.adoc @@ -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 <> 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; + } + + // ... +} +---- +====