I got below exception when I used session.getCurrentSession()
.
I have mentioned
hibernate.current_session_context_class: managed org.hibernate.HibernateException: No session currently bound to execution context at org.hibernate.context.internal.ManagedSessionContext.currentSession(ManagedSessionContext.java:75) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014) at io.dropwizard.hibernate.AbstractDAO.currentSession(AbstractDAO.java:36) at io.dropwizard.hibernate.AbstractDAO.persist(AbstractDAO.java:149)
I use this with dropwizard
. Can anyone help me to solve this?
If you are using Dropwizard Hibernate. You need to add @UnitOfWork
annotation to your Resource method. More info within dropwizard manual, hibernate chapter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With