Skip to content

checkNaturalId() #210

Open
Open
@gavinking

Description

@gavinking

In DefaultReactiveFlushEntityEventListener there is a checkNaturalId() method which seems to exist only to throw an exception if the user changes an immutable, (i.e. non-updatable) natural id property of the entity.

Now there is actually a code path in which this method can wind up hitting the database to retrieve a snapshot in getNaturalIdSnapshot(), which seems a bit excessive to me. (We hit the database to see if the user has an error in their code?)

Anyway the point is that this method would blow up in HR.

Now, I guessing, but I'm not certain, that this method is probably only called in the case of the legacy saveOrUpdate() method, which we don't support in HR, since that's usually where you have no snapshot. (IIRC, we always fetch a snapshot when using merge(), is that right?)

Now, we could either:

  1. write a reactive version of getNaturalIdSnapshot(), or
  2. simply disable this check and delete the whole method, or
  3. just ignore it for now and wait and see if it ever blows up for anyone in order to figure out what cases it occurs in.

Since option 3 means doing no work, it sounds like a pretty excellent choice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    designA design or implementation issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions