Hi all, While we use the BMP entity beans , we have to write the code for database access, transaction etc.Then why we are using entity beans why not directly connect to database from session beans???
Hi again, See in case of Session Beans you might be knowing ,they dont store the objects persistent state to a secondary storage area i.e in short they are basically client oriented and the moment the client finishes his transaction the session terminates and the bean is detroyed thus its 1:1 i.e one client per bean,session beans are transient and not persistent and they cannot share data across multiple clients but in case of Entity beans the data is persistent as long as data exists in the database and can share data across multiple clients i.e EB represent persistent state objects (things that dont go away when the user goes away).
Hence when you want to make your data to be persistent then you have to go for entity beans. Rgds, Poornima.
I think , we can have an Entity bean wherein the container takes care of persistence and Transaction. Its not always necessary for you to write code for persistence. I think you can specify the same in the deployment descriptor. Rajesh
session beans are transient and not persistent and they cannot share data across multiple clients. But if directly connect to database from session beans, and use JDBC (update, insert...) to manipulate the dabase, other clients still can share the data. RIght?