EJB INSTANCE
Hello All,
i could use some help..
Regarding EJB, when using enitiy beans from tables; the question is, for each table will have an entity bean ?
for each user using these instances .. will each user have his own instance or one instance for all users ?
so what about if we have 1000 tables, and we need to use entities from tables .. will it create 1000 entity ?
and if there are 1000 users, will each of them has his own instance ?
so, what about the CPU, memory and other resources ? how the resources can fit all these instances ?
Please answer i will really appreciate it
Thanks in advance
[649 byte] By [
basharfa] at [2007-11-27 6:26:40]

# 1
> Hello All,
>
> i could use some help..
>
> Regarding EJB, when using enitiy beans from tables;
> the question is, for each table will have an entity
> bean ?
In case of entity beans, each record in the database is represented by an instance of an entity bean. So if you have say @1000 rows in Employee table - you might end up with 1000 instances of EmployeeBean. You might have as many Entity bean classes as tables.
> for each user using these instances .. will each user
> have his own instance or one instance for all users
> ?
When a user tries to find an entity bean using any of the finders, the same instance of the entity bean will be shared by many clients. ie - if three clients want details of employee with id 1, you will have one instance in memory representing this employee and three references with each client pointing to this employee.
>
> so what about if we have 1000 tables, and we need to
> use entities from tables .. will it create 1000
> entity ?
>
> and if there are 1000 users, will each of them has
> his own instance ?
>
> so, what about the CPU, memory and other resources
> ? how the resources can fit all these instances ?
entity beans are in memory representation of your data backed by a persistent data store. This means that, all entity beans are backed by some persistent media (usually databases). Whenever the system runs out of memory, it persists the entity bean to the persistent media and deallocates the memory back.
> Please answer i will really appreciate it
>
> Thanks in advance
I hope this will give you more clarity.