You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by anasmughal <an...@yahoo.com> on 2010/11/10 17:41:46 UTC
Re: T5 Working Tapestry Hibernate with DAO.
I see you are using "HibernateSessionManager" instead of "Session" object in
your DAO.
Is it better to use HibernateSessionManager?
I would like my methods to automatically commit.
Thanks.
--
Anas Mughal
http://anas-mughal.com
--
View this message in context: http://tapestry.1045711.n5.nabble.com/T5-Working-Tapestry-Hibernate-with-DAO-tp3229905p3258981.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5 Working Tapestry Hibernate with DAO.
Posted by Rich M <ri...@moremagic.com>.
Not sure exactly what you are responding to, but..
to automatically commit from your DAO methods check out the section
about Committing Changes and the @CommitAfter annotation on this page:
http://tapestry.formos.com/nightly/tapestry5/tapestry-hibernate/userguide.html
You should be able to use @CommitAfter to automatically commit
Transactions in your DAO methods, and it will rollback Transactions when
the DAO method throws a runtime exception.
As for HibernateSessionManager and Session object, I believe it would be
the better strategy to use the HibernateSessionManager to manage your
Hibernate Session and Transaction objects. This is what the
Tapestry-Hibernate module is using, so you'll be better off getting the
Session from it, and using its commit(), abort(), etc methods (if you
don't use the @CommitAfter annotation) to allow it to manage the
Transaction for you.
Hope that helps,
Rich
On 11/10/2010 11:41 AM, anasmughal wrote:
>
> I see you are using "HibernateSessionManager" instead of "Session" object in
> your DAO.
>
> Is it better to use HibernateSessionManager?
>
> I would like my methods to automatically commit.
>
> Thanks.
> --
> Anas Mughal
> http://anas-mughal.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org