In my DOA i do the following...

        public void makePersistentUser(Users user)
                        throws InfrastructureException {

                try {
                        HibernateUtil.beginTransaction();
                        HibernateUtil.getSession().saveOrUpdate(user);
                        HibernateUtil.commitTransaction();
                        HibernateUtil.closeSession();
                } catch (HibernateException ex) {
                        throw new InfrastructureException(ex);
                }
        }

Is this the wrong way to do it?? 

On 8/30/05, Patrick Casey <[EMAIL PROTECTED]> wrote:
> 
>        Have you tried subclassing BaseEngine and doing your transaction
> management in cleanupAfterRequest() and setupForRequest() e.g.
> 
> public class CorinnaEngine extends BaseEngine {
>        private static final long serialVersionUID = 3257284742721648952L;
> 
>        protected void cleanupAfterRequest(IRequestCycle cycle) {
>                HibHelper.cleanupSession();
> 
>                super.cleanupAfterRequest(cycle);
>        }
> 
>        protected void setupForRequest(RequestContext context) {
>                HttpSession hs = MyServlet.getCurrentSession();
>                HibHelper.attachSession(hs);
>                HibHelper.getSession();
>                super.setupForRequest(context);
>        }
> 
> 
> 
> }
> 
> > -----Original Message-----
> > From: Koka [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, August 30, 2005 12:00 PM
> > To: [email protected]
> > Subject: Transaction handling. Where?
> >
> > Well, I have pages that allow to edit some database data, so I have easy
> > solution to start transaction at
> > public void pageBeginRender(PageEvent event)
> > {
> > if (event.getRequestCycle().isRewinding())
> >
> > // start transaction here
> > }
> >
> > and at
> > public void pageEndRender(PageEvent event)
> > {
> > if (event.getRequestCycle().isRewinding())
> > {
> > // Commit or rollback if errors found
> >
> > }
> > }
> >
> > Hmm, it WORKS fine but, hmmm, page render and transactions..., agrrr sure
> > there's some other place to handle things.So the question is what is the
> > right place to start/end transaction in Tap4
> > TYA
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
~chris

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to