| 1 4 package xpetstore.web.webwork.action.product; 5 6 import java.util.Iterator ; 7 8 import cirrus.hibernate.Session; 9 10 import xpetstore.domain.Item; 11 import xpetstore.domain.Product; 12 13 import xpetstore.web.webwork.action.BaseAction; 14 15 16 23 public class ProductAction 24 extends BaseAction 25 { 26 28 private Product _product = null; 29 private String _productId = ""; 30 31 33 36 protected String doExecute( ) 37 throws Exception  38 { 39 Session s = getHibernateSession( ); 40 41 try 42 { 43 _product = ( Product ) s.load( Product.class, _productId ); 44 45 49 Iterator it = _product.getItems( ).iterator( ); 50 51 while ( it.hasNext( ) ) 52 { 53 Item i = ( Item ) it.next( ); 54 i.getDescription( ); 55 } 56 57 return SUCCESS; 58 } 59 finally 60 { 61 s.close( ); 62 } 63 } 64 65 68 public Product getProduct( ) 69 { 70 return _product; 71 } 72 73 76 public String getProductId( ) 77 { 78 return _productId; 79 } 80 81 85 public void setProduct( Product product ) 86 { 87 _product = product; 88 } 89 90 94 public void setProductId( String productId ) 95 { 96 _productId = productId; 97 } 98 } 99 | Popular Tags |