/*
   * Genera el formulario de búsqueda con campos iniciales
   */
  @SuppressWarnings("unchecked")
  public String execute() {
    this.setRenderPartial("busqueda.jsp");
    entidades = new ArrayList<Entidad>();
    areas = new ArrayList<AreaConocimiento>();
    sectores = new ArrayList<Sector>();

    Session s = Hibernatable.getSession();
    s.beginTransaction();

    //		List<Entidad> entidadesC = (List<Entidad>) s.createSQLQuery("SELECT * FROM PS_STATE_TBL
    // WHERE COUNTRY = 'MEX'").
    //		addEntity(Entidad.class).list();
    //		entidades.addAll(entidadesC);
    entidades.addAll(Fakers.estadosMexico());

    List<Sector> sectoresC = s.createCriteria(Sector.class).list();
    sectores.addAll(sectoresC);

    this.cargaAreas(s);

    s.getTransaction().commit();

    return SUCCESS;
  }
  @SuppressWarnings("unchecked")
  private void execute(
      String query, Class<?> klass, String queryField, String value, ArrayList<?> list) {
    Session s = Hibernatable.getSession();
    s.beginTransaction();

    @SuppressWarnings("rawtypes")
    List results = s.createSQLQuery(query).addEntity(klass).setString(queryField, value).list();
    list.addAll(results);

    s.getTransaction().commit();
  }
  @Action("catalogoSubdisciplinas")
  public String cargaSubdisciplinas() {

    int areaId = Integer.parseInt(this.getParameters().get("area")[0]);
    int disciplinaId = 0;

    if (this.getParameters().containsKey("disciplina"))
      disciplinaId = Integer.parseInt(this.getParameters().get("disciplina")[0]);

    setSubdisciplinas(new ArrayList<Subdisciplina>());

    Session s = Hibernatable.getSession();
    s.beginTransaction();

    if (disciplinaId != 0) this.cargaSubdisciplinas(s, areaId, disciplinaId);

    s.getTransaction().commit();

    return SUCCESS + "-subdisc";
  }