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
I just noticed that the .save(Entity entity method doesn't actually saves anything if the entity id is user-provided instead of created by the database (Postgres in my case).
For now, the only workaround I see is to add another id property that can be auto-generated but this is a hugly workaround.
From my understanding, this seems to be due to EntityInformation.isNew(T entity) checking if the id property is different from null.
How could we work around this ?
The text was updated successfully, but these errors were encountered:
Repositories assume by new/existing state based on the id. If the entity is null, then we assume the entity is new. You can implement Persistable which provides theisNew() method which is used then to determine whether your entity is new or whether it should be expected to exist.
We have no support yet for optimistic locking (see #93) where we could use a @Version property to determine new/existing state.
I just noticed that the
.save(Entity entity
method doesn't actually saves anything if the entityid
is user-provided instead of created by the database (Postgres in my case).For now, the only workaround I see is to add another id property that can be auto-generated but this is a hugly workaround.
From my understanding, this seems to be due to
EntityInformation.isNew(T entity)
checking if the id property is different fromnull
.How could we work around this ?
The text was updated successfully, but these errors were encountered: