Look at the bottom of this page: http://tapestry.apache.org/tapestry5/tapestry-hibernate/userguide.html
It explains how to get @CommitAfter working with DAOs. -james On Fri, Dec 5, 2008 at 10:20 AM, Luther Baker <[EMAIL PROTECTED]> wrote: > If I inject a Hibernate session into my DAO and have my Tapestry Controller > invoke that, is there a Tapestry way that I can tell hibernate to start and > commit a transaction via annotations or configuration? > > IE: > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/BeanEditForm.html > > public class CreateUser > { > @Inject > private UserDAO userDAO; > > ... > Object onSuccess() > { > userDAO.add(user); > > return UserAdmin.class; > } > } > > public class UserDAO > { > @Inject > private Session session; > > void add(User user) > { > session.persist(user); > } > } > > > I tried to use @CommitAfter in my DAO but that didn't work. I essentially > want to simulate: > > void add(User user) > { > session.beginTransaction(); > session.persist(user); > sessino.getTransaction().commit(); > } > > but I don't want to explicitly code this in my DAO for fear that I may have > some instances where the the transactional boundaries must be larger. > > Maybe this isn't a Tapestry specific thing - but I'm not sure how to inject > the Hibernate Session into my DAO but have my Tapestry Controller define > the > transactional boundaries ... was hoping some Tapestry annotations might > help > me out. > > -Luther > -- James A. Hillyerd <[EMAIL PROTECTED]>