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
This method issues an explicit update for the given entity. The method differs from save(Object) in that an update will be generated regardless if the entity has been saved previously or not. If the entity has no assigned ID then an exception will be thrown.
Last sentence is key.
Actual Behaviour
Exceptions are not thrown and updates on entities without IDs assigned are silently ignored.
Steps To Reproduce
You can see the example app provided, but steps are:
Create an app with latest Micronaut version and Micronaut Data JDBC and H2.
Create a simple entity and a @JdbcRepository for this entity.
Create a test where you create an entity, then remove the ID for this entity and try to update it. You can also use SQL scripts to achieve the same result.
The text was updated successfully, but these errors were encountered:
Nahuel92
changed the title
Exceptions aren't thrown on updates if entity don't have an id assigned
Exceptions aren't thrown on updates if entities don't have an id assigned
Aug 5, 2024
Expected Behavior
As per
#CrudRepostory.update
JavaDocs:This method issues an explicit update for the given entity. The method differs from save(Object) in that an update will be generated regardless if the entity has been saved previously or not. If the entity has no assigned ID then an exception will be thrown.
Last sentence is key.
Actual Behaviour
Exceptions are not thrown and updates on entities without IDs assigned are silently ignored.
Steps To Reproduce
You can see the example app provided, but steps are:
Environment Information
Example Application
https://github.com/Nahuel92/poc-projects/tree/master/micronaut/micronaut-data-update-bug
Version
4.5.1
The text was updated successfully, but these errors were encountered: