I'm using POJOs and long running conversations (flush-mode MANUAL) to create a wizard with more pages.
If I'm on the last page of my wizard and try to flush the objects of the conversation, and there's a DB-error after my inserts and removes, seam will roll back the transaction. As a consequence of this the long running conversation will be in an inconsistent and unusable state (objects are detached and can't be updated any more etc. - see here http://www.seamframework.org/Community/HandlingATransactionRollback).
I can't simply forward the user to a general error page like this:
<exception class=org.hibernate.exception.ConstraintViolationException> <end-conversation before-redirect="false"/> <redirect view-id="/error.xhtml" /> </exception>
I have to stay on that page of the wizard and maintain the state (the complete information the user entered on all wizard-pages).
How can I do this?
There must be a solution to this problem, otherwise the whole SEAM-stuff (conversations etc) only complicates the programming-model without real use! It can happen rather often that a DB raises some Constraint violation Exceptions that I as programmer can't check (e.g. record is referenced from a lot of other tables)!
This is a typical problem when you work with a legacy system; it’s very common to interact with a database that “contain” business rules (i.e. trigger before insert / delete / update).
It’s surprising that Seam doesn’t offer support for this common issue.