Problem:
Wenn ich findOne aufrufe, erwartet Spring Data JPA die Rückgabe eines optionalen, aber Blaze Persistence erwartet, eine Entity View zurückzugeben. Als Ergebnis erhalte ich eine ClassCastException:
Code: Select all
java.lang.ClassCastException: class java.util.Optional cannot be cast to class xx.xxx.xxx.prestation.views.PrestationStatusView Code: Select all
(java.util.Optional is in module java.base of loader 'bootstrap'; Code: Select all
xx.xxx.xxx.prestation.views.PrestationStatusView is in unnamed module of loader 'app')Code: Select all
@Transactional(readOnly = true)
public interface PrestationStatusRepository
extends EntityViewRepository
,
EntityViewSpecificationExecutor {
}
Code: Select all
Dependencies :
com.blazebit
blaze-persistence-integration-hibernate-6.2
com.blazebit
blaze-persistence-integration-entity-view-spring-6.0
com.blazebit
blaze-persistence-integration-spring-data-3.4
${blaze-persistence.version}
com.blazebit
blaze-persistence-integration-spring-data-base-4.0
Frage
Wie kann ich Blaze Persistence mit Spring Data JPA richtig konfigurieren, damit findOne korrekt mit EntityViewSpecificationExecutor funktioniert?- Sollte ich die Verwendung von findOne direkt im Repository vermeiden?
- Gibt es eine bestimmte Blaze Persistence API Ich sollte stattdessen anrufen?
- Oder ist dies eine bekannte Inkompatibilität zwischen dem Rückgabetyp Optional von Spring Data JPA und der Entity View-Behandlung von Blaze?
Mobile version