Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem with getting collection

Desmond Lee
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there
I've been working on this problem for a while and still can't solve it, so i thought that maybe i could get some help from you guys.
I'm trying to write cleint code that will capture an instance of an Class model that is implemented using EJBs. So, basically all i do in my client code is call the home and remote interface methods to do the work and i manipulate the results.
The problem is, that when I capture an instance of the class model, and then try to recreate it, it works great. The new model matches the old one. However, when i run my client code again on the new model (made from capturing an instance of the old model) the client code will only capture 2 levels of the model.
I've gone through the code and narrowed it down to a single get statement that is suppose to return the children of a object in the model. When i call this get method a null is returned and that's why my client app does not capture the entire model. Even when this get method should return the children of the class it doesn't.
I've gone through the ejb stuff and it looks good and it's been tested so i don't think it's a problem with the ejb stuff (i may be wrong though). What i'm thinking is that the list that is returned by the get method is not updated properly. It gets updated whenever a new class is created (to check if it's a child and then if it is adds it to it's parent's list of children) or when the container calls an EJBLoad.
I'm thinking that this problem has to do with the synchronization of data using the EJBLoad() because if i restart the server and run my client app again, the client code will capture the entire model and the get method will always return a list. Since the server gets restarted and any call from running the client will have to get the information calling ejbLoad first (since it's the first call) the get method returns the correct results (where as before it returned null).
So, now that you know the problem, what i'm trying to ask is if there is any way to ensure the synchronization between the EJB pool and db. I know that the container should manage this using it's ejbLoad and ejbStore methods which you implement (and in this case seem to have been implemented correctly).
If anyone out there has any insight into this problem it would be awesome becuase i've been working on it for some time now and am still at a loss as to why the get method returns a null when it should return a list.
Any help is very much appreciated
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic