KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > xpetstore > web > webwork > action > customer > UpdateCustomerAction


1 /*
2  * Created on 25-Feb-2003
3  */

4 package xpetstore.web.webwork.action.customer;
5
6 import cirrus.hibernate.Session;
7
8 import xpetstore.domain.Customer;
9
10
11 /**
12  * @author <a HREF="mailto:tchbansi@sourceforge.net">Herve Tchepannou</a>
13  *
14  * @webwork.action
15  * name="updateCustomer"
16  * success="index.action"
17  * error="myaccount.vm"
18  */

19 public class UpdateCustomerAction
20     extends BaseSaveCustomerAction
21 {
22     //~ Methods ----------------------------------------------------------------
23

24     /**
25      * @see webwork.action.ActionSupport#doExecute()
26      */

27     protected String JavaDoc doExecute( )
28         throws Exception JavaDoc
29     {
30         String JavaDoc result = super.doExecute( );
31
32         if ( SUCCESS.equals( result ) )
33         {
34             initSession( _customer );
35         }
36
37         return result;
38     }
39
40     /**
41      * @see xpetstore.web.webwork.action.customer.BaseSaveCustomerAction#save(xpetstore.domain.Customer, cirrus.hibernate.Session)
42      */

43     public void save( Customer customer,
44                       Session session )
45         throws Exception JavaDoc
46     {
47         Customer cst = ( Customer ) session.load( Customer.class, customer.getUserId( ) );
48         cst.set( customer );
49         session.update( cst );
50     }
51 }
52
Popular Tags