File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Returning a Vector from a stateless session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Returning a Vector from a stateless session bean" Watch "Returning a Vector from a stateless session bean" New topic
Author

Returning a Vector from a stateless session bean

Randy Johnson
Greenhorn

Joined: Apr 17, 2002
Posts: 22
I have a stateless session bean. It uses a local interface to retrieve Entity Bean instances into a Vector. I then use a Java client program to access the Session Bean method that returns the Vector. When I run the client, I get an error that the Vector is not serializable. Shouldn't this work?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3879
It's not the Vector itself, it's what's in the Vector. Are you trying to put LOCAL references from Entity beans into the Vector and return that? Of course that won't work... Think about it -- that's why they're local references...
In any case, you shouldn't return Entity bean instances directly from a Session bean. The best practice is to create Value Objects from the information in the Entity beans and then return those in the Vector.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Randy Johnson
Greenhorn

Joined: Apr 17, 2002
Posts: 22
Kyle,
Thanks for the help. I guess I should have known better. (If it helps, I did get a copy of your book! - I suppose I just need to read it thoroughly).
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3879
Argh -- actually it won't help -- my book is on WebSphere 3.5 and you're working with 5.0... my new book on that topic won't be out until next year...
Kyle
 
Consider Paul's rocket mass heater.
 
subject: Returning a Vector from a stateless session bean
 
Similar Threads
Stateless Bean Calling Stateful Bean
stateless session bean and web service
Websphere Clustered Environment
EJBHomeFactory pattern and Stateless Session Bean
weblogic soap client problem with vector of vectors