Skip to content

Delete methods behave differently after upgrade to 3.5.4 #4020

@mhankus

Description

@mhankus

I've just upgraded my spring-boot app to 3.5.6, which updates also spring-data to 3.5.4
After the upgrade, our methods

which look like

 long deleteBySomeAttr(int val);

result in error

Null return value from advice does not match primitive return type for: ...

I think it can be related to 72dd53a#diff-dc360e9f00538d98dbdafa414534e321b68fe0e293fbefe37bacdb5e76cd3315R58-L411

where return value was changed from

	return jpaQuery.getQueryMethod().isCollectionQuery() ? resultList : resultList.size();

to

       return collectionQuery ? resultList : CollectionUtils.firstElement(resultList);

so when no value is deleted, null is returned, and is not converted to 0 (we have "long" as return value)

This is a breaking change in 3.5.x release. I'm not sure which is the correct way of solving this problem. Is it a bug, or return of "long" is not allowed from now on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions