3
I’m using JPA for a webservice, and I’m using the Merge
to update, but it updates all values of my object, there is some way to perform a partial update of it ?
Example, only change values that are not null ?
3
I’m using JPA for a webservice, and I’m using the Merge
to update, but it updates all values of my object, there is some way to perform a partial update of it ?
Example, only change values that are not null ?
1
The operation merge
JPA will always synchronize the entire state of the object in the database. However, there is a way to accomplish what you want:
Id
using find()
of the JPA SessionBeanUtils
to copy the non-null properties of the updated object partially produced by the service to the object loaded by find()
. See how to do hereJPA will generate the update but only the changed properties in the loaded object will have different values.
Browser other questions tagged java hibernate java-ee jpa
You are not signed in. Login or sign up in order to post.