2 Replies Latest reply on Oct 12, 2007 12:02 AM by alex_enache

    SEAM remoting problem

    alex_enache

      Hi!

      I have two classes. One is the POJO that maps on a table in my db. This is a simple class with getters and setters(the name of the class is Project). I have a ProjectManager class which I want to remotely access in javascript. I will post only the code for the ProjectManager class.

      @Scope(EVENT)
      @Name("projectManager")
      public class ProjectManager implements GeneralManager {
      
       @In(required=false) @Out(required=false)
       private Project project;
      
       @In
       private UserSession userSession;
      
       @In
       private Session hibernateSession;
      
       @WebRemote
       public List<Project> getProjects() {
       List<Project> projects = hibernateSession.createQuery("from Project p").list();
       return projects;
       }
      
       public String persist() {
       System.out.println(project.getPrjName());
       project.setUserId(userSession.getUser().getUserId());
       hibernateSession.save(project);
       return "dataPersisted";
       }
      
       public String delete() {
       return null;
       }
      
       public String update() {
       return null;
       }
      }


      When I access the getProjects method through javascript it works great. No errors there. My problem is when I try to parse the list that is returned by the method. I just don't know how to parse that array. Any clues?

      This is the js code.
      function processData() {
       Seam.Remoting.displayLoadingMessage = function(){};
       Seam.Remoting.hideLoadingMessage = function(){};
       Seam.Component.getInstance("projectManager").getProjects(projectsFoundCallback);
      
       function projectsFoundCallback(result) {
      // process results
       }
      }