Skip to content

[Spring Boot v2.6.0-RC1] Entity callbacks invoked on both entity and projections #684

@JoseLion

Description

@JoseLion

Hi,

I'm not sure if this is the right place to report this because the issue is on the Release Candidate of Spring Boot, so I'm not sure which version of spring-data-r2dbc we might need to check. Anyways, I hope this helps 🙂

I'm using Spring Boot v2.6.0-RC1 to test issue #591, which was solved and shipped on this version. However, I noticed that custom entity callbacks are invoked for both the entity and any projection of that specific entity. I'm not sure if this is the expected behavior though, it could be convenient not having to repeat the same callbacks for many projections. But on the other hand, projections are usually intended to have fewer fields than the actual entity, so it can be easy to fall into NullPointerExceptions and errors of that sort.

Given this behavior is intended, what would be the best/safest way to tell if the entity received in the callback is some specific projection and not the entity?

As always, I'll be more than happy to help with a PR if needed. I'd only need some guidance in the best approach to take on this.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions