We're using ByteBuddy to track which fields in persistence entities are set.
To do that, we write the field name and value to a map.
To ensure backward-compatibility, we also call the super's setters, which set fields in the base class.
At runtime, the modified methods look like this:
public void setFoo(Long var1) {
SetterInterceptor.interceptSetter(cachedValue$jbu0XnWD$qevi042, var1, this);
super.setFoo(var1);
}
But that means they are no longer atomic. Two threads calling the same setter on the same instance of the entity could wind up with different values in the map vs. the original field.
Is there a way to add synchronized to the generated setters in the subclass?
We're using ByteBuddy to track which fields in persistence entities are set.
To do that, we write the field name and value to a map.
To ensure backward-compatibility, we also call the super's setters, which set fields in the base class.
At runtime, the modified methods look like this:
But that means they are no longer atomic. Two threads calling the same setter on the same instance of the entity could wind up with different values in the map vs. the original field.
Is there a way to add synchronized to the generated setters in the subclass?