Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Collections which are serializable

 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In stateful session beans we are not allowed to use collections which are not serializable. I tested that by using HashTable and it indeed fails. My question is: what should I use in case I need to have a collection class.
thanks.
- walk rustin
 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HashTable itself is serializable. You have to make sure what you put in HashTable is serializable. Also, you should not use the collection than is returned by values() method, because what you get is something that implements Collection, but you do not know if that is serializable. Look at page 72 of HFEJB for more details.
 
Walker Rustin
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response. Appreciate it.
- walk rustin
SCBCD
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!