• Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Bean Global Variables

 
Dave Donohoe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an Entity Bean with 2 global vectors.
I call one method to populate the vectors (& the vectors DO get populated).
Then I call another method to access the Vectors, but the Vectors are empty.
I do not re-instantiate the bean, & I dont overwrite the Vectors.
The vectors are declared as private.
Any ideas?
D
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even if by some miracle you do get this working (and I doubt you will -- many container vendors (you don't mention which one you use) play tricks with classloaders that screw up static variables) you should NOT do this. The EJB specification specifically forbids using static variables directly in EJB's. For example, the WebSphere container will actually flag the use of a static variable in an EJB as an error and won't let you deploy it...
Now what is it you really want to do?
Kyle
 
Dave Donohoe
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kyle,
Thanks for your reply.
The init method of the bean will go to the database & pull back & store a list of users.
When a user logs onto the client, the user name is sent to the bean & I have to check the vector to see if the User is in the Vector - a boolean is returned to the client indicating whether or not the user was found....
This is my first attempt at writing an EJB so please forgive my igonorance - the variables are not static....merely global - does this make a difference?
D
[ March 24, 2002: Message edited by: Dave Donohoe ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!