I have two collections, which by default are set to PersistentSet by hibernate. The issue is that under the hood hibernate casts them to HashSet, but I want them to be set to LinkedHashSet, as I want to preserve the order in which the elements are added.
@ElementCollection(fetch = FetchType.LAZY)
private Set<String> responsibilities;
@ElementCollection(fetch = FetchType.LAZY)
private Set<String> requirements;
I have tried a couple of things, but without success
public void setResponsibilities(LinkedHashSet<String> responsibilities) {
this.responsibilities = responsibilities;
}
public void setRequirements(LinkedHashSet<String> requirements) {
this.requirements = requirements;
}
The other thing I tried was:
@ElementCollection(fetch = FetchType.LAZY)
private Set<String> requirements = new LinkedHashSet<>();