Cheers guys,
Ok, my next question will somehow deviate from the initial question but it still in the domain of returned Collection and findAll getter.
By using a session facade
pattern.
On the client
1.lookup Session home;
2.create remote interface named say remote_conection
3.get all the records to be just displayed. remote_conection.getAllRecords()
Is the wright way to go on this?
We would both have on the server and on the client the class Record:
public class Record implements Serializable
{
private int id;
private
String name;
private double value;
public Record(int id_t,String name_t,double value_t);
public int getId();
.
.
.
}
On the server side in the SessionBean
public Collection getAllRecords()
{
Vector v=new Vector();
//get home of the records entity bean;
Iterator it=home.findCompanyRecords().iterator();
while(it.hasNext())
{
//getting from the Company Entity bean the records
remote=(CompanyRemote) javax.rmi.PortableRemoteObject.narrow(i.next(),CompanyRemote.class);
//fillup the Record class
Record rcd=new Record(remote.getId(),remote.getName(),remote.getValue());
v.add(rcd);
}
return v;
}
And on the client side we need to suply the Record class and begin the whole thing again
Iterator it=remote_conection.getAllRecords().iterator();
while(it.hasNext())
{
Record r=(Record)i.next();
}
Now is it just me or some other people feel entangled and get to confuse some things with other?
I know the session facade is not there to just mimic all the entity beans methods, but besides the bussines stuff employed in the session bean, there will be times when you would need to return some collections to the client, the records in the database. So the question: is that how you would do it? Another Serializable class that you need time to fill up with the records returned by the entity bean and gets passed to the client(it seems to me like doing something twice)?
[ March 22, 2005: Message edited by: Balamaci Serban ]