Accessing private fields vs. using annotated get method
posted 8 years ago
I just discovered today that you can access the private fields of another instance of the same class in a copying method:
Not sure if this is intended to be possible.
Anyway, my question. If the getter for field x was annotated with @Column (hibernate for example, mapping it to a db table column), would the copyFrom() method cause problems? Field x might not be initialized in the toBeCopied object (with fetchtype lazy). When just accessing the field, and NOT using the getter, the value of the field would not be obtained or would it?
Sorry I'm a hibernate noob. I guess I'll change the method copyFrom anyway just to be sure, but would still like to know if my doubt is valid.