Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Returning a Vector from a stateless session bean

 
Randy Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Randy Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic