View Javadoc

1   /*
2    * Created on Sep 14, 2004
3    *
4    * TODO To change the template for this generated file go to
5    * Window - Preferences - Java - Code Style - Code Templates
6    */
7   package ch.ledcom.hephaistos;
8   
9   import net.sf.hibernate.Criteria;
10  import net.sf.hibernate.HibernateException;
11  import net.sf.hibernate.Session;
12  import net.sf.hibernate.expression.Expression;
13  
14  import org.apache.log4j.Logger;
15  import org.apache.struts.action.ActionForm;
16  
17  import ch.ledcom.hephaistos.abstractActions.HibernateGetAction;
18  import ch.ledcom.hephaistos.dao.ProductClass;
19  
20  /***
21   * @author gehel
22   *
23   * @struts.action
24   *  name="productClassForm"
25   *  path="/ProductClassGet"
26   *  validate="false"
27   * @struts.action-forward
28   *  name="success"
29   *  path="/pages/productClassEdit.jsp"  
30   * @struts.action-forward
31   *  name="failure"
32   *  path="/pages/productClassList.jsp"
33   */
34  public class ProductClassGetAction extends HibernateGetAction {
35  
36    private static final Logger logger = Logger
37    .getLogger(ProductClassGetAction.class);
38  
39    /* (non-Javadoc)
40     * @see ch.ledcom.afs.web.HibernateGetAction#doGet(org.apache.struts.action.ActionForm, net.sf.hibernate.Session)
41     */
42    protected ActionForm doGet(Long id, Session session)
43        throws HibernateException {
44      ProductClassForm form = new ProductClassForm();
45      Criteria criteria = session.createCriteria(ProductClass.class);
46      criteria.add(Expression.eq("id", id));
47      
48      ProductClass productClass = (ProductClass) criteria.uniqueResult();
49      
50      form.setId(productClass.getId());
51      form.setNo(productClass.getNo());
52      form.setNameF(productClass.getNameF());
53      form.setNameD(productClass.getNameD());
54      
55      logger.debug("id    : " + form.getId());
56      logger.debug("no    : " + form.getNo());
57      logger.debug("nameF : " + form.getNameF());
58      logger.debug("nameD : " + form.getNameD());
59      
60      return form;
61    }
62  
63  }