Quantcast
Viewing all articles
Browse latest Browse all 34

Answer by Kunal for Get Hibernate Initialized object in JSP

Thanks everyone for your time and patience the solution was simple.The problem was that i was getting 2 different errors and one of them was that i wasn't initializing JpatrocinadoresPassatempos correctly and then i needed to initialize it's childs like so:

Session session = this.sessionFactory.getCurrentSession(); List JpassatemposList = session.createQuery("select Jpassatempos from Jpassatempos p where p.dataFim > current_date and p.flgPago=true and p.id not in (select c.jpassatempos from Jcodigos c where c.jconcorrentes.id=? group by c.jpassatempos) order by p.dataFim desc").setParameter(0, id).list();

    for(int i =0; i< JpassatemposList.size(); i++){        Hibernate.initialize(JpassatemposList.get(i).getJpatrocinadoresPassatemposes());        for(JpatrocinadoresPassatempos pp : JpassatemposList.get(i).getJpatrocinadoresPassatemposes()){           Hibernate.initialize(pp.getJpatrocinadores());        }    }    return JpassatemposList;

Once again thanks everyone :)


Viewing all articles
Browse latest Browse all 34

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>