Uable to achieve aggressive/eager loading at Collection level.
I know eager loading at collection level with XML
but How I could achieve the same with annotation at collection level.?
Student Persistence Class
Here I need to do eager loading for Collection Type semails field.
If you are using hibernate you can use @Fetch
annotation with FetchMode.JOIN. This will make hibernate use join and fetch collection with a single select query joining your element collection table.
Make sure your collection has two annotations:
@ElementCollection(fetch=FetchType.EAGER)
@Fetch(FetchMode.JOIN)