Thanks for the comprehensive answer. Right now I am testing the HibernateSessionManager usage. I added it as the field in my page: @Inject private HibernateSessionManager hibernateSessionManager;
and then I commit it in the onFormSubmit method: public void onFormSubmit(Object observable, Object o) { Application application = (Application) o; application.setUser(user); applicationDao.save(application); hibernateSessionManager.commit(); publisher.sendApplicationSubmittedMessage(user.getId(), application.getId()); } But I feel quite ashamed of this solution. It's like forcing the inner mechanism of Tapestry's Hibernate Wrapper (or even the Hibernate by itself, it's flow) to commit the thing before it is appropriate. However switching from Hibernate to JPA is not an option for me and Interceptors, if I understand them well, seems like an overhead. 2016-02-25 15:52 GMT+01:00 Thiago H de Paula Figueiredo <thiag...@gmail.com> : > On Thu, 25 Feb 2016 11:30:44 -0300, g kuczera <gkucz...@gmail.com> wrote: > > In the end I gave up implementing the JPA, because I do not want to mix >> these two different approaches (Hibernate sessions and JPA). >> > > The suggestion would be using JPA instead of Hibernate, not mixing them. > > So I have one questions: where do I find the HibernateSessionManager >> implementation? >> > > > https://github.com/apache/tapestry5/blob/master/tapestry-hibernate-core/src/main/java/org/apache/tapestry5/internal/hibernate/HibernateSessionManagerImpl.java > > It looks that I can't use regular >> session.getTransaction().commit() becase it gives me *Transaction not >> successfully started *error. >> > > In this case, you should start the transaction manually, just as you > commit it manually. > > I have been reading about these (hibernate and tapestry) machanisms and it >> looks that every thread has it's own session, which is being managed by >> HibernateSessionManager. I am not pretty sure how to obtain that manager, >> to safely commit the transaction. >> > > It's a Tapestry-IoC service, so you can @Inject it in your pages or have > it automatically injected into your services' constructors. > > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >