View Javadoc

1   package ecar.dao;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   
6   import javax.servlet.http.HttpServletRequest;
7   
8   import org.hibernate.HibernateException;
9   import org.hibernate.Query;
10  
11  import comum.database.Dao;
12  
13  import ecar.pojo.ItemEstrtIndResulIettr;
14  
15  public class ItemEstrtIndResulIettrDao extends Dao {
16  
17    public ItemEstrtIndResulIettrDao(HttpServletRequest request) {
18      super();
19      this.request = request;
20    }
21  
22    public ArrayList<ItemEstrtIndResulIettr> getIndicadoresMetaFisicaPPA(Long codIett) {
23  
24      try {
25  
26        final Long CLASSIFICACAO_META_FISICA_PPA = 41L;
27  
28        StringBuilder sb = new StringBuilder();
29        sb.append("from ItemEstrtIndResulIettr bean");
30        sb.append(" where ");
31        sb.append(" bean.sisAtributoSatb.codSatb = :codSatb ");
32        sb.append("and bean.itemEstruturaIett.codIett = :codIett ");
33        sb.append("and bean.indAtivoIettr = :status ");
34  
35        Query query = session.createQuery(sb.toString());
36  
37        query.setLong("codIett", codIett.longValue());
38        query.setLong("codSatb", CLASSIFICACAO_META_FISICA_PPA);
39        query.setString("status", "S");
40  
41        List retorno = (List) query.list();
42        return (ArrayList<ItemEstrtIndResulIettr>) retorno;
43  
44      } catch (HibernateException e) {
45        e.printStackTrace(System.out);
46        this.logger.error(e);
47        return null;
48      }
49    }
50  
51  }