2 Replies Latest reply on Nov 27, 2007 12:38 PM by leandro sabin

    @DataModel problem

    leandro sabin Newbie


      I have the following component which retrieves a list of courses done by a employee. This works fine but when I included some code to get a list of courses that match a certain input the list of courses is not retrieved (actually the method listCoursesEmployee() is not invoked at all).

      public class CourseAction {
       private EntityManager entityManager;
       private Tecnico selectedEmployee;
       private List<CursoCurriculum> listCoursesEmployee = new ArrayList<CursoCurriculum>();
       public CourseAction(){}
       public void listCoursesEmployee(){
       if (selectedEmployee != null)
       Curriculum cvEmpleado = null;
       cvEmpleado = selectedEmployee.getCurriculum();
       if (cvEmpleado != null)
       listCoursesEmployee = cvEmpleado.getCursos();

      But if I move the code that gets the list of courses to another component everything works. This is the code in the new component:

      public class CursosAction {
       private EntityManager entityManager;
       private String nombreCurso;
       List<Curso> listaCursosParcial = new ArrayList<Curso>();
       public CursosAction(){}
       public List<Curso> getListaCursosParcial(){
       return listaCursosParcial;
       public void setNombreCurso(String nombreCurso) {
       this.nombreCurso = nombreCurso;
       public void obtieneCursosParcial(){
       String patron = "";
       patron = (nombreCurso == null) ? "%" : ('%' + nombreCurso.toLowerCase().replace('*', '%') + '%');
       listaCursosParcial = entityManager.createQuery(
       "from Curso where LOWER(nombre) like :patron order by nombre")

      I want to have all the code in the first component. If this is posible what am I doing wrong?