2 Replies Latest reply on Sep 25, 2007 11:04 AM by kurdt

    Fetch Type Eager But Objets not retrieved

    kurdt

      Hi All guys

      I hope this is not so newbie question, I was an EJB2 developer in the past, and I made the switch to EJB3 with Hibernate, I have an entity defined like this:

      @Entity
      @Table(name="USER")
      public class User implements Serializable {
      
       private Long id;
       private String full_name;
       private String username;
       private Level level;
      
      [...]
      
       @OneToOne(fetch=FetchType.EAGER,cascade=CascadeType.MERGE)
       public Level getLevel() {
       return level;
       }
       public void setLevel(Level level) {
       this.level = level;
       }
      
      


      "Level" is another entity, and a table One to One relation at Database.

      The problem is that when I retrieve one "User" from the DB the "level" object is not being populated (it is null), even that I set the Fetch Type to Eager.

      What am I missing?