I'm creating a Spring Web MVC 3.1.1 application with Hibernate 3.2.5. I'm developing in Netbeans 7.2, application server is GlassFish 3.1.2. The database is Mysql 5.5.

My problem is that there is no eager loading for a subclass `@OneToMany`, while another class with a `@OneToMany` is able to load. This problem presents itself only on Glassfish: when I run a local script with exactly the same logic, there is no problem.

relevant Hibernate config:

```
<hibernate-configuration>
  <session-factory>
    <property name="hibernate.hbm2ddl.auto">update</property>
    <mapping class="blagae.db.game.Game"/>
    <mapping class="blagae.db.game.GamePhase"/>
    <mapping class="blagae.db.game.Series"/>
    <mapping class="blagae.db.play.Play"/>
  </session-factory>
</hibernate-configuration>

```

The basic idea is that of an American football game. A `Game` contains several `GamePhases` (`Series`, `Kickoffs`, `Half Time`, `End Of Game`); a `Series` contains `Plays`, which are subclassed further.

**`GamePhase` & `Game` (these work):**

```
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class GamePhase implements Serializable {
  @Id
  @GeneratedValue
  private int gamePhaseID;
  @ManyToOne(fetch = FetchType.EAGER)
  private Game game;
}

@Entity
public class Game implements Serializable {
  @Id
  @GeneratedValue
  private int gameID;
  @OneToMany(cascade=CascadeType.ALL, mappedBy="game", fetch=FetchType.EAGER)
  private List<GamePhase> gamePhases = new ArrayList<GamePhase>();

  public List<GamePhase> getGamePhases() {
    return gamePhases;
  }

  public void setGamePhases(List<GamePhase> gamePhases) {
    this.gamePhases = gamePhases;
  }

  public Series getFirstGamePhase() throws Exception {
    if (gamePhases.isEmpty() || gamePhases == null) {
        throw new Exception ("List<GamePhase> error");
    }
    return gamePhases.get(0);
  }
}

```

**`Series` (<- `GamePhase`) and `Play`:**

```
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Play implements Countable, Serializable {
  @ManyToOne
  private Series series;
}

@Entity
public class Series extends GamePhase implements Countable {
  @OneToMany(cascade=CascadeType.ALL, mappedBy="series",fetch=FetchType.EAGER)
  private List<Play> plays = new ArrayList<Play>();

  public List<Play> getPlays() {
    return plays;
  }

  public void setPlays(List<Play> plays) {
    this.plays = plays;
  }

  public Play getFirstPlay() throws Exception {
    if (plays.isEmpty() || plays == null) {
        throw new Exception ("List<Play> error");
    }
    return plays.get(0);
  }
}

```

When I run the following code locally, I get a normal response:

```
Session session = SessionFactoryHelper.getSession();
try {
    GamePhase gp = ((Game) session.get(Game.class, 1)).getFirstPlay();
    System.out.println("GamePhaseID="+gp.getGamePhaseID());
    Play play = ((Series) session.get(Series.class, 1)).getFirstPlay();
    System.out.println("PlayID="+play.getPlayID());
}
catch (Exception e) {
  e.printStackTrace(System.out);
}

```

> 
> response: GamePhaseID=1 PlayID=1
> 
> 
> 

When I run this in a JSP (please excuse the scriptlets, I'm still learning the basics on JSTL).

```
<% Game game = (Game) request.getAttribute("game");
List<GamePhase> series = game.getDrives(); %>
<p> <%=game.getFirstGamePhase() %> </p>

<%for (GamePhase gamePhase : series) {
      if (gamePhase.isSeries()) { 
Series series = (Series) gamePhase;%>
<table>
  <tr>
    <td> <%= series.getGamePhaseID() %>
    </td>
    <td> Play <%= series.getFirstPlay() %>
    </td>
  </tr>
</table>

```

The `getFirstPlay()` method fails because `List<Play>` plays is null. If I comment out `<%-- series.getFirstPlay() --%>`, the code works and renders well.

As far as I can see, the only difference is that the `@OneToMany` in `Play` refers to a subclassed entity, whereas the `@OneToMany` in `GamePhase` doesn't ...

Any ideas?