I'm working with PanacheRepositories in Quarkus.
Currently I want to realize the function update(X x).
Basically what I want is the function to do is check if an entity y exists having id==x.id exists and update it to x, however I can't figure out if this is possible without having to deep copy every attribute from x into y.
I don't want that, because the object is huge.
Is there any way to do something like
MyEntity y = repository.findById(x.id);
if(y != null){
y = x;
repository.persist(y)
}
without detaching the entity?
I didn't realize that
PanacheRepositoryis just an overlay ofEntityManager, which has the functionality I'm looking for. So I could just inject theEntityManagerand usemerge(x)which did exactly what I wanted