If there is an error you need to rollback your transaction (cancel all
changes made to the db).
Rollback is a flag I use to see whether or not there was an error. 

So for example to check for error in wicket you can do this

MyRequestCycle extends RequestCycle {
        public void onRuntimeError(...) {
                .....
                hibernatelocator.getlocator().markrollback();
                ....
        }
}


When the hibernate filter runs at the end of request it will know there was
an error and it needs to roll back the transaction.

-Igor

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Jonathan Locke
> Sent: Friday, July 29, 2005 12:50 PM
> To: wicket-user@lists.sourceforge.net
> Subject: Re: [Wicket-user] Hibernate/EJB3.0
> 
> 
> i have added some basic transaction semantics support to the 
> wicket-contrib-database.
> 
> for now, i've just got TRANSACT_OPERATIONS and TRANSACT_REQUEST.
> you can set the value globally with
> Database.setDefaultTransactionSemantics() or per-db-session 
> with DatabaseSession.setTransactionSemantics(). 
> 
> i haven't added anything about mark-rollback.  what exactly 
> does that do?
> 
> Igor Vaynberg wrote:
> 
> >I am using a single-transaction-per-request pattern - in my 
> case I want 
> >to rollback the transaction even if there was a ui error - 
> that way the 
> >user isnt confused as to why he got an error but the changes 
> got saved.
> >
> >When I was using h3 I had a
> >
> >Interface hibernatesessionlocator() {
> >     session getsession();
> >     void markrollback();
> >     boolean hassession();
> >}
> >
> >I have an implementation of it that upon the first request to 
> >getsession() creates a session, begins a transaction, and sticks the 
> >session into a request attribute.
> >
> >The app can retrieve a session or mark it for rollback using 
> the locator.
> >
> >Then I had a filter that would at the end of the request either 
> >rollback or commit the transaction and close the session.
> >
> >The only diff with ejb3 is that you don't need the locator to create 
> >entitymanager/transaction as it is done for you.
> >
> >-Igor
> >
> >
> >
> >
> > 
> >
> >  
> >
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] On Behalf Of 
> >>[EMAIL PROTECTED]
> >>Sent: Friday, July 29, 2005 10:29 AM
> >>To: wicket-user@lists.sourceforge.net
> >>Subject: RE: [Wicket-user] Hibernate/EJB3.0
> >>
> >>Getting my hands on a WAR to see how you integrated 
> hibernate would be 
> >>great. I'd be very appreciative.
> >>
> >>Unfortunately, I am not starting from scratch and I am 
> trying to see 
> >>how well wicket grafts onto an existing project that has many DAO's 
> >>that return POJO beans. We are currently moving them into 
> EJB3 objects 
> >>and the whole process is still quite new to me.
> >>
> >>I would be interested to see where/how you are building the 
> Hibernate
> >>(EntityManager?) connection. From what Igor is saying it 
> sounds like 
> >>the connection is built up in the Wicket application and 
> the objects 
> >>are loaded on the attatch events.
> >>Perhaps we can flesh out this aspect of wicket in the wiki 
> a bit more.
> >>
> >>-Paul
> >>
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED]
> >>[mailto:[EMAIL PROTECTED] On Behalf Of Phil 
> >>Kulak
> >>Sent: Friday, July 29, 2005 12:30 PM
> >>To: wicket-user@lists.sourceforge.net
> >>Subject: Re: [Wicket-user] Hibernate/EJB3.0
> >>
> >>I'll be committing a new version of CDApp shortly using rewritten 
> >>databinding and Hibernate3 integration. If you're not into 
> the whole 
> >>CVS thing, I can post a WAR somewhere so that you can get a 
> feel for 
> >>it.
> >>
> >>On 7/29/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> >>    
> >>
> >>> 
> >>>Paul,
> >>>Im not aware of any official docs yet. I am currently using
> >>>      
> >>>
> >>wicket as
> >>a
> >>    
> >>
> >>>presentation tier for ejb3 project, and its pretty easy to
> >>>      
> >>>
> >>integrate. 
> >>    
> >>
> >>>  
> >>>IMHO there are two main areas that need integration: application
> >>>      
> >>>
> >>object, and
> >>    
> >>
> >>>detachable models for entities. 
> >>>  
> >>>In the constructor's application object i get all needed
> >>>      
> >>>
> >>service bean
> >>    
> >>
> >>>references or locators and set them as member variables. So now
> >>>      
> >>>
> >>anywhere in
> >>    
> >>
> >>>your wicket components you can do
> >>>((MyApplicationClass)getApplication()).getService().doSomething();
> >>>and your getService() can be implemented either as getService() {
> >>>      
> >>>
> >>return
> >>    
> >>
> >>>service; } or getService() { return
> >>>      
> >>>
> >>serviceLocator.locate(); } you can
> >>    
> >>
> >>>implement helper funcs in your page subclass to eliminate casting.
> >>>  
> >>>As far as detachable models go in the onAttach() you can do pretty
> >>>      
> >>>
> >>much the
> >>    
> >>
> >>>same thing: 
> >>>  
> >>>public void onAttach() {
> >>>   
> >>>
> >>>      
> >>>
> >>obj=((MyApplicationClass)RequestCycle.get().getApplication()).
> >>getService
> >>().load(....);
> >>    
> >>
> >>>}
> >>>  
> >>>  
> >>>Igor
> >>>  
> >>>  
> >>>  
> >>>  
> >>> 
> >>> 
> >>> 
> >>> ________________________________
> >>> From: [EMAIL PROTECTED]
> >>>[mailto:[EMAIL PROTECTED] On Behalf Of 
> >>>[EMAIL PROTECTED]
> >>>Sent: Friday, July 29, 2005 8:52 AM
> >>>To: wicket-user@lists.sourceforge.net
> >>>Subject: [Wicket-user] Hibernate/EJB3.0
> >>>
> >>> 
> >>> 
> >>> 
> >>>
> >>>Greetings,
> >>>
> >>>  
> >>>
> >>>I'm evaluating several web frameworks including Wicket for
> >>>      
> >>>
> >>an internal
> >>    
> >>
> >>>project and I was wondering if there was some documentation on
> >>>      
> >>>
> >>Hibernate or
> >>    
> >>
> >>>EJB3.0 somewhere that I am missing. I found the
> >>>      
> >>>
> >>wicket-contrib package
> >>at
> >>    
> >>
> >>>http://wicket-stuff.sourceforge.net/ as well as the 
> >>>HibernateObjectModel object in there. I also saw a quick 
> run down on
> >>>      
> >>>
> >>Phil's
> >>    
> >>
> >>>weblog: http://jroller.com/page/pKulak/ that seems like a 
> good start
> >>>      
> >>>
> >>but I'm
> >>    
> >>
> >>>failing to see how it all fits together. Is there an example
> >>>      
> >>>
> >>application
> >>    
> >>
> >>>(PetStore-ish?) that uses EJB3 or Hibernate available to look at? 
> >>>
> >>>  
> >>>
> >>>Overall I really like the direction of this project. Keep
> >>>      
> >>>
> >>up the good
> >>work. 
> >>    
> >>
> >>>  
> >>>
> >>>-Paul
> >>>      
> >>>
> >>-------------------------------------------------------
> >>SF.Net email is Sponsored by the Better Software Conference & EXPO 
> >>September 19-22, 2005 * San Francisco, CA * Development Lifecycle 
> >>Practices Agile & Plan-Driven Development * Managing 
> Projects & Teams 
> >>* Testing & QA Security * Process Improvement & Measurement * 
> >>http://www.sqe.com/bsce5sf 
> >>_______________________________________________
> >>Wicket-user mailing list
> >>Wicket-user@lists.sourceforge.net
> >>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >>
> >>
> >>-------------------------------------------------------
> >>SF.Net email is sponsored by: Discover Easy Linux Migration 
> Strategies 
> >>from IBM. Find simple to follow Roadmaps, straightforward articles, 
> >>informative Webcasts and more! Get everything you need to get up to 
> >>speed, fast.
> >>http://ads.osdn.com/?ad_idt77&alloc_id492&op=ick
> >>_______________________________________________
> >>Wicket-user mailing list
> >>Wicket-user@lists.sourceforge.net
> >>https://lists.sourceforge.net/lists/listinfo/wicket-user
> >>
> >>
> >>    
> >>
> >
> >
> >
> >
> >-------------------------------------------------------
> >SF.Net email is sponsored by: Discover Easy Linux Migration 
> Strategies 
> >from IBM. Find simple to follow Roadmaps, straightforward articles, 
> >informative Webcasts and more! Get everything you need to get up to 
> >speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&opÌk
> >_______________________________________________
> >Wicket-user mailing list
> >Wicket-user@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
> >  
> >
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration 
> Strategies from IBM. Find simple to follow Roadmaps, 
> straightforward articles, informative Webcasts and more! Get 
> everything you need to get up to speed, fast. 
> http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 
> 




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to