Question

I am using java/blazeds/flex. So basically I have method in java:

public ArrayList<Employee> getAllEmployees(){
    ...
    ArrayList<Employee> employees = new ArrayList<Employee>();
    pst = JavaConnection.getConnection()
              .prepareStatement("select * from employee order by lastname");
    rs = pst.executeQuery();

    while (rs.next()){
        Employee employee = new Employee();
        employee.setId(rs.getInt("id"));
        employee.setFirstName(rs.getString("firstName"));
        employee.setLastName(rs.getString("lastName"));
        employees.add(employee);
    }
    ...
    return employees;
}

but in flex from remoteobject result i get ArrayCollection where all elements are with Object datatype but not with Employee. By the way I also have have value object class in flex.

[RemoteClass(alias="domain.Employee")]
public class Employee
{
    public var id:int;
    public var firstName:String;
    public var lastName:String;
    ...
}

So I am not sure why I get object datatype.
How to fix this?

Hope I made some sense, because I am not very good with terminology.

Was it helpful?

Solution

Thanks RIAstar, you were right, it was imported badly.
Though I had import valueobject.Employee; in my model but apparently you have to create instance variable from value object class also. After that it worked. What I don't understand is why instance variable is necessary.. it doesn't even matter in which method I create it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top