0 Replies Latest reply on Feb 23, 2012 2:34 AM by chinna1231

    Hibernate Session is Lossing ....Why ?? with Seam 3.0  with CDI

    chinna1231

      Hi Guys

       

      I am Using  Seam 3 with CDI

       

      My Project Structure is Like this :

       

      its has Mentioned in screen shots once view it

       

      Actually i am  View (JSF Part ) in JPMS (See Screen shot project Structure.JPG)

       

      POJOS and serviceClass in JPMSEJB..

       

      so while accessing the List of Values form EJB Module in JSF Part i  am getting this error

       

      LAZY INTIALIZATION EXCEPTION  because the hibernate session is getting close  and i am calling frem ejb through JSF

       

      for Example this is my pojo

       

      @Entity

      @Table(name = "user_tbl")

      @Named("user")

      public class User implements Serializable {

       

      private List<Role> roles = new ArrayList<Role>();

       

           @ManyToMany(targetEntity = Role.class,fetch = FetchType.LAZY)

          @JoinTable(name = "user_role_tbl", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))

          public List<Role> getRoles() {

                  return roles;

          }

       

          public void setRoles(List<Role> roles) {

              this.roles = roles;

          }

       

      }

       

      In JSF :

       

      This is List of Roles. i am calling  in JSF Page ,that time its giving    LAZY INTIALIZATION EXCEPTION

       

      So pleas Help me sort the Session for entire Application .......