You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One check is BidirectionalSynchronizationEvent, which is basically a check for Hibernates @OneToMany relationship and requests to add boilerplate code to keep the relationship on both sides in sync by adding
@OneToMany(mappedBy = "one")
private Set<MyDOM> many= new HashSet<>();
public void removeOne(MyDOM a) {
many.remove(a);
a.setOne(null);
}
public void addOne(MyDOM a) {
many.add(a);
a.setOne(this);
}
It would be nice to have a Lombok annotation for that.
The text was updated successfully, but these errors were encountered:
@OneToMany(mappedBy = "one")
private Set<MyDOM> many= new HashSet<>();
both methods should be added. Lombok can't look at the other class, so it has to assume that in MyDOM the setter exists. I guess, that's OK.
Do you think that Lombok should do it, whenever it sees a field annotated with javax.persitence.OneToMany with a mappedBy field? Or only when an additional Lombok annotation is given?
Personally, i think it would be good to have a class-level annotation similar to @Setter or @Getter , that handles this specific persistence case.
I am sure, there are more cases like this, give the fact that hypersistance optimizer passes a few events around with (mild) suggestions regarding code quality/boilerplate.
We are using Vlad Mihalceas Hypersistance Optimizer, a tool to check your data model for inconvenient usages.
One check is BidirectionalSynchronizationEvent, which is basically a check for Hibernates
@OneToMany
relationship and requests to add boilerplate code to keep the relationship on both sides in sync by addingIt would be nice to have a Lombok annotation for that.
The text was updated successfully, but these errors were encountered: