You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the entity id is not automatically generated, it's possible that an insert will trigger a primary key violation. That's a pretty common case, and a custom validator would be needed in order to avoid reporting it as an "unknown error".
Should we provide some support for this scenario in commons-backend? (either as an ad-hoc validator, or as some exception postprocessing.)
The text was updated successfully, but these errors were encountered:
Detecting this while trying to save an existing ID could be useful to force the user to use the right method (save or update) for the action that he's trying to do, because if you use save with an existing ID, the entity will be updated. Maybe the user tried to persist a new entity but ended up updating an existing one, without noticing it.
I'm not sure if Commons Backend should do something in this scenario. Whether the entity id is automatically generated or not is a JPA mapping decision. Implementing this would require to "configure" the library in a "automatically generated id" mode so the validation is useful or not.
When the entity id is not automatically generated, it's possible that an insert will trigger a primary key violation. That's a pretty common case, and a custom validator would be needed in order to avoid reporting it as an "unknown error".
Should we provide some support for this scenario in commons-backend? (either as an ad-hoc validator, or as some exception postprocessing.)
The text was updated successfully, but these errors were encountered: