Skip to content

MethodInvocationRecorder (and later on TypedSort) has issues with primitive return types #2612

Closed
@ullenboom

Description

@ullenboom

My entity bean has a persistent property of type short with corresponding Setter/Getter:

public short getHornlength() {
  return hornlength;
}

public void setHornlength( short hornlength ) {
  this.hornlength = hornlength;
}

Using this in a TypedSort

Sort.TypedSort<Profile> sortedProfile = Sort.sort( Profile.class );
Sort sort = sortedProfile.by( Profile::getHornlength ).ascending();
List<Profile> sortedProfiles = profiles.findAll( sort );

results in

Caused by: org.springframework.aop.AopInvocationException: Null return value from advice does not match primitive return type for: public short com.tutego.boot.jpa.entity2.Profile.getHornlength()
    at org.springframework.aop.framework.CglibAopProxy.processReturnType(CglibAopProxy.java:395) ~[spring-aop-5.3.16.jar:5.3.16]
    at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85) ~[spring-aop-5.3.16.jar:5.3.16]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:700) ~[spring-aop-5.3.16.jar:5.3.16]
    at com.tutego.boot.jpa.entity2.Profile$$EnhancerBySpringCGLIB$$c4896dd1.getHornlength(<generated>) ~[classes/:na]

Using my other non-primitive persistent properties works as expected:

Sort sort =       sortedProfile.by( Profile::getBirthdate ).ascending()
            .and( sortedProfile.by( Profile::getLastseen ).descending() );

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions