Please help me find a solution to this problem.
There seems to be a problem in Hibernate with the @OneToMany annotation when there are multiple collections for fecth.
When I try to do this, it gives this exception Caused by: org.hibernate.loader.MultipleBagFetchException: cannot simultaneously fetch multiple bags .
And this is my entity class:
@Entity @Table(name = "game", catalog = "competition_manager") public class Game implements java.io.Serializable { private List<GamePlayerGoals> gamePlayerGoalses = new ArrayList<GamePlayerGoals>(0); private List<GamePlayer> gamePlayers = new ArrayList<GamePlayer>(0); @OneToMany(fetch = FetchType.EAGER, mappedBy = "game") public List<GamePlayerGoals> getGamePlayerGoalses() { return this.gamePlayerGoalses; } @OneToMany(fetch = FetchType.EAGER, mappedBy = "game") public List<GamePlayer> getGamePlayers() { return this.gamePlayers; } }
But my question is: is it impossible to get more than the OnetoMany annotated collection in Hibernate? Thanks in advance.
source share