1
2
3
4
5
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.HibernateDeleteAction;
18 import ch.ledcom.hephaistos.dao.ProductClass;
19
20 /***
21 * @author gehel
22 *
23 * @struts.action
24 * path="/ProductClassDelete"
25 * validate="false"
26 * @struts.action-forward
27 * name="success"
28 * path="/ProductClassList.do"
29 * @struts.action-forward
30 * name="failure"
31 * path="/ProductClassList.do"
32 */
33 public class ProductClassDeleteAction extends HibernateDeleteAction {
34
35 private static final Logger logger = Logger
36 .getLogger(ProductClassDeleteAction.class);
37
38
39
40
41 protected ActionForm doDelete(Long id, Session session)
42 throws HibernateException {
43 ProductClassForm form = new ProductClassForm();
44 Criteria criteria = session.createCriteria(ProductClass.class);
45 criteria.add(Expression.eq("id", id));
46
47 ProductClass productClass = (ProductClass) criteria.uniqueResult();
48
49 logger.info("Deleting productClass " + productClass.getNo());
50
51 session.delete(productClass);
52
53 return form;
54 }
55
56 }