Unable to save the 'Account' object changes

Suddenly I get in some entities the following error

The object has just been changed by another user or by the system.
In order to avoid conflicts or data loss, please reopen the screen and reapply your changes.

which is not true. I cannot edit these entities anymore ;(

2024-03-27T08:21:17.634+01:00 DEBUG 21900 — [nio-8080-exec-8] io.jmix.eclipselink.impl.JpaDataStore : save: cascaded: []
2024-03-27T08:21:17.634+01:00 DEBUG 21900 — [nio-8080-exec-8] i.jmix.core.datastore.AbstractDataStore : save: store=main, entities to save: [ag.myself.crm.entity.Account-0 [detached]], entities to remove: []
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] .j.e.i.JmixEclipselinkTransactionManager : Creating new transaction with name [JpaDataStore-save-8]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] .j.e.i.JmixEclipselinkTransactionManager : Opened new EntityManager [io.jmix.eclipselink.impl.JmixEntityManager@36ced] for JPA transaction
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] .j.e.i.JmixEclipselinkTransactionManager : Exposing JPA transaction as JDBC [org.springframework.orm.jpa.vendor.EclipseLinkJpaDialect$EclipseLinkConnectionHandle@297532c]
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] i.j.eclipselink.impl.JmixEntityManager : merge ag.myself.crm.entity.Account-0 [detached]
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] .j.e.i.JmixEclipselinkTransactionManager : Initiating transaction rollback
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] .j.e.i.JmixEclipselinkTransactionManager : Rolling back JPA transaction on EntityManager [io.jmix.eclipselink.impl.JmixEntityManager@36ced]
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] .j.e.i.JmixEclipselinkTransactionManager : Closing JPA EntityManager [io.jmix.eclipselink.impl.JmixEntityManager@36ced] after transaction
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] i.j.f.e.OptimisticLockExceptionHandler : Optimistic lock: jakarta.persistence.OptimisticLockException: Exception [EclipseLink-5010] (Eclipse Persistence Services - 4.0.2-2-jmix.v202401181328): org.eclipse.persistence.exceptions.OptimisticLockException
Exception Description: The object [ag.myself.crm.entity.Account-0 [detached]] cannot be merged because it has changed or been deleted since it was last read.
Class> ag.myself.crm.entity.Account
2024-03-27T08:21:17.635+01:00 DEBUG 21900 — [nio-8080-exec-8] io.jmix.flowui.Notifications : Notification is closeable so duration property will be ignored

How can I debug what is going wrong ?

If you use HSQLDB, try to avoid assigning 0 as the entity identifier.

It is the same with MariaDB and I did work with that 0 for the last months. This is a new feature …

OK, thanks. We’ll take a look.

This happens because you trying to edit Pk of the entity. I answered for you here: BUG Entity with PK 0 not possible to edit - #2

I don’t try to edit the PK !

At the existing account 0 i try to edit with standard CRUD the description account to another description text, for example account 2. When I want to save this changed description, the system shows the message
grafik

which is wrong. I want to change the description on an existing entity.

A solution found BUG Entity with PK 0 not possible to edit - #7 by yuribakunx !

1 Like