I would like to do a simple update on a managed JPA entity on many fields. First I query the entity which I would like to update:
MyEntity managedEntity = entityManager.createQuery(query).getSingleResult();
Then I need to update this entity with a new "MyEntity" object which is not managed by JPA:
MyEntity notManagedEntity = new MyEntity();
Of course it would be possible to read each field from notManagedEntity and set them to managedEntity which would do the update.
But is there a more elagant way to update the managed entity without needing to get and set every field one by one?