I try to compare two objects - one of them is LAZY loaded:
@Entity
public class Path{
public void removePoint(Point point) {
if (point.getPath() != null && point.getPath() != this) {
throw new IllegalArgumentException(String.format("Point %s does not belong to path%s", point, this));
}
point.setPath(null);
this.getPoints().remove(point);
}
}
Check:
window.getPath().removePoint(point);
The problem is that these two objects don't have the same reference: point.getPath()
and this
The question is if the reason why these 2 obejcts have different references is that one of them is LAZY loaded (sth like Path$HibernateProxy$Di4Siuwn@32825
)?
question from:
https://stackoverflow.com/questions/66066158/java-spring-how-to-check-if-two-objects-are-equal-and-one-of-them-is-lazy-loaded 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…