KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Created on 25-Feb-2003
3  *
4  * To change this generated comment go to
5  * Window>Preferences>Java>Code Generation>Code Template
6  */

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

23 public class MyAccountAction
24     extends BaseAction
25 {
26     //~ Instance fields --------------------------------------------------------
27

28     private Customer _customer = new Customer( );
29
30     //~ Methods ----------------------------------------------------------------
31

32     /**
33      * @see webwork.action.ActionSupport#doExecute()
34      */

35     protected String JavaDoc doExecute( )
36         throws Exception JavaDoc
37     {
38         Session s = getHibernateSession( );
39
40         try
41         {
42             _customer = ( Customer ) s.load( Customer.class, getUserId( ) );
43
44             return SUCCESS;
45         }
46         finally
47         {
48             s.close( );
49         }
50     }
51
52     /**
53      * @return Customer
54      */

55     public Customer getCustomer( )
56     {
57         return _customer;
58     }
59
60     /**
61      * Sets the customer.
62      * @param customer The customer to set
63      */

64     public void setCustomer( Customer customer )
65     {
66         _customer = customer;
67     }
68 }
69
Popular Tags