Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

calling a method in hibernate DAO through JMX export MBean

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using spring 3 and hibernate for my application framework and JBoss as application server. I am calling a method inside DAO through an externalized MBean.
and get the following error:

org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

Here is my DAO class. I have observed that it gives the error on Session session = sessionFactory.getCurrentSession();



It extends MercerChatDAO, the code for which is as follows:



and here is the configuration for hibernate:




Please guide me how to go about the solution.
 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did a few changes like added <tx:annotation-driven/> to my applicationContext-db.xml and added @Transactional to the DAO class. I am able to go one step ahead now but facing

ERROR [LazyInitializationException] failed to lazily initialize a collection of role: com.ifs.app.model.adaptors.ScheduleGroupAdaptor.vendorServiceTransports, no session or session was closed

Its because after the data is fetched from the database I try doing a lazy loading from my code as follows:



In the while (it.hasNext()) it throws the error. Please guide me how to go about this now ?
 
What a stench! Central nervous system shutting down. Save yourself tiny ad!
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic