We recently joined up to an existing project and in several entity classes we have seen the following code example:
@OneToMany(mappedBy = "department")
private List<Employee> employee= new LinkedList<>();
I had a discussion with a developer about using ArrayList instead of LinkedList for hibernate. But the arguments from both sides were not clear enough.
Usually, i use for many purposes an ArrayList. Here is a good comparison
- Does hibernate under the hood work better with that?
- Is there a reason why linkedList is used?
- Or has it simply been used unknowingly in the project?