I already solved it.

I overrided the process() method of the form and caught the exception there.


carloc wrote:
> 
> Hi guys, I need clarity on this...
> 
> This is what my detachable model
> public CCTIDetachableModel extends Loadable DetachableModel {
> 
> private String id;
> private Integer version;
> private Dao dao;
> 
> public Object load() {
>     MyObject myobj = dao.get(id);
>     if (version == null) {
>       version = myobj.getVersion();
>     }
>     else  if (!myobject.getVersion().equals(version)) {
>       throw new MyVersionMismatchException(MyObject.class, id, version);
>     }
> 
>     return myobj;
>   }
> }
> 
> I use an AjaxDefaultDataTable or DefaultDataTable on my page.
> 
> So the record appears appropriately with the approprirate checkboxes
> corresponding to each model.
> Each checkbox is mapped to a detachable model.
> 
> Everytime I click the delete button which is an IndicatingAjaxButton,
> The exception is thrown how ever I'm not able to catch the exception it on
> the onSubmit() method of my 
> button.
> 
> It doesn't enter the onSubmit or the onError() method of the
> indicatingajaxbutton.
> 
> The process never seems to enter the onSubmit() method of my indicating
> ajax button instead it goes directly to the DetachableModel where the
> exception is thrown giving me no chance to catch the exception.
> 
> How do I resolve this?
> 
> Here's the stacktrace
> 
> com.ccti.exception.common.VersionMismatchException
>      at
> com.ccti.web.query.QueryDetachableModel.load(QueryDetachableModel.java:31)
>      at
> org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:111)
>      at org.apache.wicket.Component.getModelObject(Component.java:1265)
>      at
> org.apache.wicket.markup.html.form.CheckGroup.convertValue(CheckGroup.java:154)
>      at
> org.apache.wicket.markup.html.form.FormComponent.convertInput(FormComponent.java:1112)
>      at
> org.apache.wicket.markup.html.form.FormComponent.validate(FormComponent.java:1016)
>      at
> org.apache.wicket.markup.html.form.Form$15.validate(Form.java:1651)
>      at
> org.apache.wicket.markup.html.form.Form$ValidationVisitor.formComponent(Form.java:152)
>      at
> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:400)
>      at
> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrderHelper(FormComponent.java:387)
>      at
> org.apache.wicket.markup.html.form.FormComponent.visitFormComponentsPostOrder(FormComponent.java:365)
>      at
> org.apache.wicket.markup.html.form.Form.visitFormComponentsPostOrder(Form.java:980)
>      at
> org.apache.wicket.markup.html.form.Form.validateComponents(Form.java:1647)
>      at org.apache.wicket.markup.html.form.Form.validate(Form.java:1638)
>      at org.apache.wicket.markup.html.form.Form.process(Form.java:792)
>      at
> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:764)
>      at
> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:126)
>      at
> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:163)
>      at
> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:282)
>      at
> org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:100)
>      at
> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:90)
>      at
> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1019)
>      at org.apache.wicket.RequestCycle.step(RequestCycle.java:1094)
>      at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1173)
>      at org.apache.wicket.RequestCycle.request(RequestCycle.java:483)
>      at
> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:277)
>      at
> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:129)
>      at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
>      at
> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
>      at
> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
>      at
> org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
>      at
> org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
>      at
> org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
>      at
> org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
>      at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
>      at org.mortbay.http.HttpServer.service(HttpServer.java:909)
>      at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
>      at
> org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
>      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
>      at
> org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
>      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
>      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
> 

-- 
View this message in context: 
http://www.nabble.com/Versioning-Problems-With-DataTable%2C-Spring-Hibernate-tf4484198.html#a12836668
Sent from the Wicket - User mailing list archive at Nabble.com.


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

Reply via email to