Merge, migration and oprimistic lock

Hi All
Before for migration data from one persistence to another I used merge method because it allowed to preserve ids of entities.
But after 6.6 this approch does not work.
the message I receive is
jakarta.persistence.OptimisticLockException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
Сan I solve this with unsaved-value?
Could you please suggest how I can setup a factory to cover my case or any tricks with annotation or some else using methods of EntityManager interface.
Point me please in which direction to dig.
Thank you.

I suppose you’re affected by the bug fix mentioned in the ORM 6.6 migration guide.
There is no easy solution, because you have to reset the sequence value as well when you want to insert data with fixed identifier values to avoid running into constraint violations later.