• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Returning a Vector from a stateless session bean

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic