0 Replies Latest reply on Jul 31, 2013 1:03 AM by bin fang


    bin fang Newbie

      i I spend a lot of timeWorking on this problem but fail  please help me


      The environment is jboss 7.1  ,use the jboss7.1 jar


      I am in accordance with the resteasy-jaxrs-3.0.1 user guid




      Below is my configuration



























      my service code







      public class ModelsFacadeREST  extends AbstractFacade<Models> implements IModlesFacade{



         @PersistenceContext(unitName = "PU2")


            private EntityManager em;


          public ModelsFacadeREST() {






          protected EntityManager getEntityManager() {

             return em;








      public interface IModlesFacade {





             @Produces({"application/xml", "application/json"})

          public List<Models> findAll();






      public abstract class AbstractFacade<T> {

          private Class<T> entityClass;



          public AbstractFacade(Class<T> entityClass) {

              this.entityClass = entityClass;




          protected abstract EntityManager getEntityManager();


          public List<T> findAll() {

              javax.persistence.criteria.CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery();


              return getEntityManager().createQuery(cq).getResultList();






      @Table(name = "et_models")



      public class Models implements Serializable {

          private static final long serialVersionUID = 1L;


          @Basic(optional = false)

          @Column(name = "model_name")

          private String modelName;


          @OneToMany(mappedBy = "modelName",fetch=FetchType.EAGER)


          private List<CodingSchemes> codingSchemesList;



          public Models() {




          public Models(String modelName) {

              this.modelName = modelName;



      when i  visiite


      it Submitted to the wrong

      HTTP Status 500 - org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.bjgoodwill.hip.ets.CodingSchemes.versionsList, no session or session was closed


      I don't understand the reasons and how handle this probelm.thanks you can eamil me wfkjzyxy_001@163.com thanks very much thanks