Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » NotReadablePropertyException while using SpringData projection
NotReadablePropertyException while using SpringData projection [message #1810059] Tue, 30 July 2019 07:46
Wojciech Korczynski is currently offline Wojciech KorczynskiFriend
Messages: 1
Registered: July 2019
Junior Member
I have the following problem with using Spring Data on EclipseLink - I use projections in order to get selected properties of the objects in database. I have an entity named "Campaign":
    @Table(name = "campaign")
    public class Campaign implements Serializable {

        private String id;
        private CampaignState state = CampaignState.NEW;
        // getters and setters...


CampaignState is some enum. Then, I added the following projection:

    public interface CampaignStateView {
        CampaignState getState();

...which I use in my repository:
    public interface CampaignRepository extends
            JpaRepository<Campaign, String>,
            QuerydslPredicateExecutor<Campaign> {

        @Query("SELECT DISTINCT c.state AS state FROM Campaign c")
        List<CampaignStateView> findDistinctStates();

I use this repository in my service:
    public class CampaignDataService {

        private CampaignRepository campaignRepository;

        // for CDI proxy
        public CampaignDataService() {

        public CampaignDataService(CampaignRepository campaignRepository) {
            this.campaignRepository = campaignRepository;

        public Collection<CampaignState> findStates() {
            return campaignRepository.findDistinctStates().stream()


But, unfortunately, when I call a method findStates() from the service, I get the following exception:

Caused by: org.springframework.beans.NotReadablePropertyException: Invalid property 'state' of bean class [campaign.CampaignState]: Could not find field for property during fallback access! 
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( 
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( 
         at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( 
         at org.springframework.aop.framework.JdkDynamicAopProxy.invoke( 
         at com.sun.proxy.$Proxy301.getState(Unknown Source) 
         at campaign.CampaignDataService$$Lambda$491.000000006DCDF7C0.apply(Unknown Source) 
         at java.util.Vector$VectorSpliterator.forEachRemaining( 
         at campaign.CampaignDataService.findStates(
         ... 118 more 

I get this error only on EclipseLink - on Hibernate everything works fine... Thank you in advance for any help!
Previous Topic:Composite foreign key with a fixed value generates wrong SQL
Next Topic:EclipseLink PreUpdate on OneToOne Relationship not persisted
Goto Forum:

Current Time: Thu May 30 13:42:22 GMT 2024

Powered by FUDForum. Page generated in 0.03395 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top