Re: Calling method after CommitAfter call

2016-03-22 Thread g kuczera
Guys, I forgot to tell you that since applying the "HibernateSessionManager.commit()" everything works like a charm. It looks that it was indeed the problem with synchronisation. 2016-02-26 13:14 GMT+01:00 Thiago H de Paula Figueiredo : > On Fri, 26 Feb 2016 07:54:47 -0300, g kuczera wrote: > >

Re: Calling method after CommitAfter call

2016-02-26 Thread Thiago H de Paula Figueiredo
On Fri, 26 Feb 2016 07:54:47 -0300, g kuczera wrote: 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. I disagree. Tapestry-Hibernate i

Re: Calling method after CommitAfter call

2016-02-26 Thread Dmitry Gusev
Hi, The tapestry-jpa-transactions module doesn't use any JPA interceptors, its before/after commit hooks are implemented in the same advice that opens and commits transactions for @CommitAfter. In theory you could do the same for Hibernate too. But in your case you could extract business logic th

Re: Calling method after CommitAfter call

2016-02-26 Thread g kuczera
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, Ob

Re: Calling method after CommitAfter call

2016-02-25 Thread Thiago H de Paula Figueiredo
On Thu, 25 Feb 2016 11:30:44 -0300, g kuczera 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 d

Re: Calling method after CommitAfter call

2016-02-25 Thread g kuczera
In the end I gave up implementing the JPA, because I do not want to mix these two different approaches (Hibernate sessions and JPA). So I have one questions: where do I find the HibernateSessionManager implementation? It looks that I can't use regular session.getTransaction().commit() becase it gi

Re: Calling method after CommitAfter call

2016-02-24 Thread g kuczera
> > But I think a JPA hook would be a better choice. The Interceptor hooks > happen for *all* the transactions in your SessionFactory, and JPA hooks are > more fine-grained. I am not really into JPA thing, but if I understand well I have to add the whole new configuration (in AppModule), as stated

Re: Calling method after CommitAfter call

2016-02-24 Thread Thiago H de Paula Figueiredo
On Wed, 24 Feb 2016 19:33:13 -0300, g kuczera wrote: I will try tomorrow the HibernateSessionManager.commit. But what do you think, guys, about Hibernate Interceptor? It has something similar to what Kalle mentioned, afterTransactionCompletion and beforeTransactionCompletion. Have you ever u

Re: Calling method after CommitAfter call

2016-02-24 Thread g kuczera
> > I'm sorry, I disagree. It's called Commit*After*, so I read that as the > commit is done *after* the method call. It's not CommitWithin. :) By using "module" I meant my piece of code:) Somebody - it was not me! - have called the function before being sure, that the transaction is committed. O

Re: Calling method after CommitAfter call

2016-02-24 Thread Thiago H de Paula Figueiredo
On Wed, 24 Feb 2016 17:23:36 -0300, g kuczera wrote: Hi guys, Hi! It looks that the above module is badly designed. It does not matter that there is the CommitAfter annotation, if I call the methods which assume that everything is commited from within the commiting method. Am I right? I'

Re: Calling method after CommitAfter call

2016-02-24 Thread Kalle Korhonen
On Wed, Feb 24, 2016 at 12:27 PM, g kuczera wrote: > Sorry for not editing the post properly, I accidentally sent it by pressing > the space few times (first time using the fullscreen editing on gmail). > > So, the question is if the hibernate Interceptor is the way to go? Do you > have any other

Re: Calling method after CommitAfter call

2016-02-24 Thread g kuczera
Sorry for not editing the post properly, I accidentally sent it by pressing the space few times (first time using the fullscreen editing on gmail). So, the question is if the hibernate Interceptor is the way to go? Do you have any other idea how to be 100% sure that my method from observer will be