Open clun opened 1 year ago
/cc @FroMage (panache), @loicmathieu (panache)
IIRC we did not include merge
by design, to avoid people using it too much and running into issues. Right, @Sanne ?
I thought it would be better to write it here rather than opening a new issue.
If we initially wrote some data to the database with a load script, the duplicate key value violates problem occurs with Panache because the Id is not defined explicitly.
If we define the Id explicitly, we get the exception detached entity passed to persist. I think this exception message in particular is quite confusing.
Can't the default Id provider mechanism obtain the next primary key value of the table before persisting the entity?
Description
In a project, I had to create a few entities in one go, and
persist()
orpersistAndFlush()
were not good enough i got "Detached entity passed to persist" error messageI had to use the
merge
of the entity manager. As of today it is not available in aPanacheRepository
So I had to add in my repository:
Implementation ideas
I know it is only 2 lines of code but I would propose you to add to
PanacheRepositoryBase