When I change a property of an object and save it, I need to know the value of the property before it was saved, and the value of the property after it has been saved. I have overriden afterUpdate of the object in business logic, but the property shows the same value in the both part objects, the part and the part in the result map. Both show the new saved result of the property. Is it supposed to work like this, and is there another way to know what have changed in afterUpdate?
@Async
@Override
public void afterUpdate(RunnerContext context, Part part, ExecutionResult<Part> result) throws Exception {
}
Yeah I should have been more clear. That is exactly what I do.
And the column property that I change is a 1:N relation property. I need to know if the update added or removed a pointer, or if it was another property that changed. Currently if I add a relation on the client side and save, in afterUpdate, the length of the array containing the relations is always the same in the two objects that I retrieve in afterUpdate.
I just tested with the simple text property. It is the same with that property. If I change the text and call save, both the objects in afterUpdate shows the updated property.
Client sends updated object to custom service.
Service loads the actual object via persistence.
You can then distinguish what Kind of Operation (insert/update) will happen.
Save the newvalue, report to client whatever you like.
Yeah that could work thanks. I was just hoping the the afterUpdate metod would provide the object before the update and the object after the update, but I see now that this is not the case.