values getting shared across in multiple beans

Discussions

EJB programming & troubleshooting: values getting shared across in multiple beans

  1. I have a stateful bean(let's call it AllocationBean).
    This AllocationBean creates another stateful bean (call it
    DBBean) to lookup data in the database and computes some value. When it's done it inserts 10 rows in the database.

    Now, I have a servlet which when gets invoked creates ten AllocationBean and as a result 100 rows get inserted. Everything is fine so far.

    If I invoke this servlet multiple times(say 3) simultaneously then 300 rows get inserted but values are not correct. Looks like values are getting shared across different instance of bean. Any idea?

    Thanks,
    Prabhat
  2. I'm afraid the description of the problem is too short to suggest anything. What are the differences among these three calls? Should the values depend on the newly inserted rows? Check your code on "static" word. Does you allocation bean create and remove DBBean in the business method or in ejbCreate? When exectly does the servlet create the AllocationBean? etc