Re: @CommitAfter not committing my transaction

2012-11-29 Thread Thiago H de Paula Figueiredo
On Wed, 28 Nov 2012 22:16:35 -0200, Pillar sotodel...@hotmail.com wrote: I'm not in a position to test it right now, so I won't say if it worked. Where does Tapestry get that session for you? If you're using tapestry-hibernate and @Inject'ing it, @CommitAfter will work. Otherwise, no. --

Re: @CommitAfter not committing my transaction

2012-11-29 Thread Thiago H de Paula Figueiredo
On Wed, 28 Nov 2012 22:28:58 -0200, Pillar sotodel...@hotmail.com wrote: Ok, so I didn't know that, I thought SessionFactory was a singleton. It never was. If you're connecting to two different databases, you'll need a SessionFactory for each. -- Thiago H. de Paula Figueiredo

Re: @CommitAfter not committing my transaction

2012-11-29 Thread Howard Lewis Ship
The idea with @CommitAfter is that Tapestry is responsible for handling the transaction, using the session-in-view pattern. The session is created lazily, when first needed. The transaction for the session is committed at the end of a method with @CommitAfter. The session is available to be

Re: @CommitAfter not committing my transaction

2012-11-29 Thread Pillar
While we are on the subject. @CommitAfter commits the transaction after the called method. What if I call multiple methods annotated with @CommitAfter? The commits happen after each of them. If I reach a method where an Exception is raised and I need to rollback, will it rollback every transaction

Re: @CommitAfter not committing my transaction

2012-11-29 Thread Pillar
More questions: I have an onSuccess() method in my Page class that calls a DAO delete method annotated with @CommitAfter. When the onSuccess() gets called (I'm using a form with a submit) the delete doesn't get commit at the end of the request (although I see hibernate log it). If I annotate the

Re: @CommitAfter not committing my transaction

2012-11-29 Thread Pillar
Answer my question too. I read that little bit you linked and I understand the HibernateTransactionAdvisor does it for you. -- View this message in context: http://tapestry.1045711.n5.nabble.com/CommitAfter-not-committing-my-transaction-tp5718364p5718408.html Sent from the Tapestry - User

Re: @CommitAfter not committing my transaction

2012-11-29 Thread Lenny Primak
I am not sure, never used Tapestry transaction support, but if you want full transaction support, use JEE On Nov 29, 2012, at 5:06 PM, Pillar sotodel...@hotmail.com wrote: More questions: I have an onSuccess() method in my Page class that calls a DAO delete method annotated with

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Norman Franke
I don't think you should start your own transaction. Remove the beginTransaction(). Norman Franke Answering Service for Directors, Inc. www.myasd.com On Nov 28, 2012, at 2:59 PM, Pillar wrote: Unless I'm understanding it wrong, the @CommitAfter on my method isn't committing the

RE: @CommitAfter not committing my transaction

2012-11-28 Thread Tony Nelson
You should also Inject the session. @Inject private Session session; Is this method in a controller, or do you have a DAO layer? -Original Message- From: Pillar [mailto:sotodel...@hotmail.com] Sent: Wednesday, November 28, 2012 2:59 PM To: users@tapestry.apache.org Subject: @CommitAfter

RE: @CommitAfter not committing my transaction

2012-11-28 Thread Pillar
It is in a Controller. If it was in DAO Layer, do I still use the @Inject for a session or get it from HibernateUtils style class? Now regardless of if I get the Transaction from the Session I'm given from the SessionFactory, shouldn't Tapestry be finding the same Transaction and committing it?

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Josh Canfield
I'm not sure why you'd expect Tapestry to find a session that it didn't create and commit a transaction that it doesn't know about? On Wed, Nov 28, 2012 at 1:07 PM, Pillar sotodel...@hotmail.com wrote: It is in a Controller. If it was in DAO Layer, do I still use the @Inject for a session

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Pillar
As far as I know a Hibernate Session has only one Transaction at a time, hence the session.beginTransaction, session.getTransaction(). Also, the SessionFactory has the getCurrentSession() which returns a per thread session. So unless, I'm completely wrong in how I think tapestry-hibernate is

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Jay Ginete
I believe you are suppose to inject the Hibernate session. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Pillar
I'm not in a position to test it right now, so I won't say if it worked. Where does Tapestry get that session for you? But you are right, that is smarter/better than popping out your own every time. -- View this message in context:

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Josh Canfield
Tapestry-Hibernate creates it's own instance of the SessionFactory http://tapestry.apache.org/current/apidocs/index.html?org/apache/tapestry5/internal/hibernate/HibernateSessionSourceImpl.html You can have multiple SessionFactory instances (if you have multiple databases for instance) so calling

Re: @CommitAfter not committing my transaction

2012-11-28 Thread Pillar
Ok, so I didn't know that, I thought SessionFactory was a singleton. I will use Tapestry-Hibernate the way it's meant to just like in the link you posted. Thanks! -- View this message in context: