That helps. :)

Thanks very much.

Jonathan

On 17/03/2008, Matt Raible <[EMAIL PROTECTED]> wrote:
>
>  On Mar 17, 2008, at 6:16 AM, Jonathan Ritchie wrote:
>
>  > Lets suppose that my application is creating a new "Folder" object in
>  > a database and then adding some permission objects for some users.
>  >
>  > The controller at the moment looks something like this in vague
>  > pseudo code.
>  >
>  > String folderName = getFolderName();
>  > Folder folder = getFolderService().createFolder(folderName);
>  >
>  > List<User> users = getUsers();
>  > for (User user : users) {
>  >         getPermissionService().createPermission(folder,
>  > somepermission);
>  > }
>  >
>  > So the problem is that if something goes wrong with the permission
>  > adding I also want to rollback the creation of the folder.
>
>
> I would suggest moving this code into a Manager. That way, if
>  anything goes wrong, the entire operation is rolled back. Also, if
>  you use "*Service" as a name, the class won't be wrapped in a
>  transaction. This is because the transaction-wrapping rule is as
>  follows (in applicationContext-service.xml):
>
>  <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution
>  (* *..service.*Manager.*(..))" order="2"/>
>
>  Hope this helps,
>
>
>  Matt
>
>
>  >
>  > The documentation I can find operates on a single manager, so its easy
>  > for me to add transactions to the folder service or permission service
>  > in the applicationContext but I dont understand how to link them
>  > together.
>  >
>  > Any advice is appreciated.
>  >
>  > Jonathan
>  >
>  > On 14/03/2008, Flavio Froes <[EMAIL PROTECTED]> wrote:
>  >> transactions are usually works on the service level (Managers).
>  >> spring should manage your transactions. configure it on your
>  >> applicationContext.xml if it is not already configures...
>  >>
>  >> HTH,
>  >>
>  >> Flávio Oliva
>  >>
>  >>
>  >> On Fri, Mar 14, 2008 at 5:00 PM, Jonathan Ritchie
>  >> <[EMAIL PROTECTED]>
>  >> wrote:
>  >>>
>  >>> Hello
>  >>>
>  >>> I have built a large chunk of a webapp using appfuse2. Its been
>  >>> great,
>  >>> thanks for the work on the skeleton.
>  >>>
>  >>> I have a couple of questions however.
>  >>>
>  >>> I am using a Spring MVC Basic archetype and am not sure how
>  >>> transcationality is supported in hibernate and/or appfuse.
>  >>>
>  >>> Basically at the most simple level I would like transactions at the
>  >>> controller level - so if there is an exception or error thrown in a
>  >>> controller's submit method I would like to roll back to the state at
>  >>> the start of the submit.
>  >>>
>  >>> How do I go about doing that? Is there any documentation that would
>  >>> help me understand whats involved?
>  >>>
>  >>> Secondly, something is going wrong (I think) with error handling.
>  >>> I am
>  >>> pretty sure that when a controller threw an exception when I
>  >>> first had
>  >>> a basic project working it redirected to an error page. Now its just
>  >>> printing the exception to the browser window and its looking pretty
>  >>> messy.
>  >>>
>  >>> Is there any documentation or advice anyone can offer me on how
>  >>> error
>  >>> handling works?
>  >>>
>  >>> Again, my required solution is pretty simple. If a controller throws
>  >>> an exception in any of its methods then I want to redirect to a
>  >>> fixed
>  >>> error page with the stack trace available to me.
>  >>>
>  >>> Thanks for any advice or information and sorry if these questions
>  >>> have
>  >>> been asked before.
>  >>>
>  >>> Jonathan
>  >>>
>  >>>
>  >> ---------------------------------------------------------------------
>  >>> To unsubscribe, e-mail:
>  >> [EMAIL PROTECTED]
>  >>> For additional commands, e-mail: [EMAIL PROTECTED]
>  >>>
>  >>>
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

Reply via email to