Difference between @LazyCollection(LazyCollectionOption.FALSE) and @OneToMany(fetch = FetchType.EAGER)
The fundamental difference between the annotations is that @OneToMany
and its parameters (e.g. fetch = FetchType.EAGER
) is a pure JPA. It can be used with any JPA provider, such as Hibernate or EclipseLink.
@LazyCollection
on the other hand, is Hibernate specific, and obviously works only if Hibernate is used.
If possible, try to stick to the JPA specification as much as possible. By doing this, you should be able to switch provider easily (at least in theory).
As for your real problem, could it be that you are using a Hibernate version that doesn't support JPA 2.0 as this answer suggests?