I need to know while designing an application how to decide about using entity and session beans for database interaction.
for example there is a form for entering customer details(name,address and phone).Once the user enter the details they have to be stored in the database.Now my problem is whether i should develop entity or session bean for storing details in database.In some books enity bean is used for dbms storage while in some cases session bean is used.
For storing details in dbms which bean do u vote-session or entity and why?
Please show some light on resolving this issue in EJBs.
Thanks
Sweety
-
Design Issue-Entity vs Session for dbms (6 messages)
- Posted by: Sweety Verma
- Posted on: May 04 2001 05:01 EDT
Threaded Messages (6)
- Design Issue-Entity vs Session for dbms by Vismay Shah on May 04 2001 07:03 EDT
- Design Issue-Entity vs Session for dbms by Adinarayana Rao Rayavarapu on May 04 2001 13:55 EDT
- Design Issue-Entity vs Session for dbms by Sweety Verma on May 05 2001 00:43 EDT
-
Design Issue-Entity vs Session for dbms by Sridhar Panatula on May 08 2001 08:52 EDT
-
Design Issue-Entity vs Session for dbms by Sridhar Panatula on May 08 2001 08:55 EDT
- Design Issue-Entity vs Session for dbms by Kiran Kedlaya on May 16 2001 03:02 EDT
-
Design Issue-Entity vs Session for dbms by Sridhar Panatula on May 08 2001 08:55 EDT
-
Design Issue-Entity vs Session for dbms by Sridhar Panatula on May 08 2001 08:52 EDT
- Design Issue-Entity vs Session for dbms by Sweety Verma on May 05 2001 00:43 EDT
-
Design Issue-Entity vs Session for dbms[ Go to top ]
- Posted by: Vismay Shah
- Posted on: May 04 2001 07:03 EDT
- in response to Sweety Verma
Entity Beans used for the database purpose. From session bean you can also access database but it won't be container managed and you can call entity bean from session bean by declaring instances. -
Design Issue-Entity vs Session for dbms[ Go to top ]
- Posted by: Adinarayana Rao Rayavarapu
- Posted on: May 04 2001 13:55 EDT
- in response to Sweety Verma
You have two parts to your question: (a) Customer information and (b) Business process of updating customer information
(a) This is an entity bean because all database objects are entity beans.
(b) This is the session bean. You wrap your entity bean (a) with session bean (b).
-
Design Issue-Entity vs Session for dbms[ Go to top ]
- Posted by: Sweety Verma
- Posted on: May 05 2001 00:43 EDT
- in response to Adinarayana Rao Rayavarapu
Session beans are not sharable between multiple clients while entity beans are sharable.If we use session bean for calling updateCustomer method which will call entity bean in turn,then does that mean that only one client can call update method at a time then how will it resolve the requests by multiple clients who are updating the data and calling update method at the same time.
-
Design Issue-Entity vs Session for dbms[ Go to top ]
- Posted by: Sridhar Panatula
- Posted on: May 08 2001 20:52 EDT
- in response to Sweety Verma
As mentioned by Adi,
You use Entity bean for Database Persistance and Session Beans for the Logic over it.
In otherwords any kind of formating or calculations are done in the session bean and then the Entity Bean can be used for making the data persistant.
You can also not use the Entity Bean at all and Handle the Database storage and Manipulation in your session bean.
When it is done it still make it available to other clients accessing the Data. If you are using Entiy Beans and CMP then the data is automatically persistant for you.
But in the second case when you use Session Bean which is like BMP the data updated(Modified/Added) by one Client is available to another client when requested by the Client.
A seperate session bean is created by each clients request and if the changes are available at the time of query in the database they will be made available .
So for your particular query about the UPDATE, if more than one Client does it then it happens so many times. and it is reflected in the DB as soon as the Trasaction is over.
Good luck..
-
Design Issue-Entity vs Session for dbms[ Go to top ]
- Posted by: Sridhar Panatula
- Posted on: May 08 2001 20:55 EDT
- in response to Sridhar Panatula
I should apologize for not reading it through.
If we use Session Bean to call entiy bean ..
If more than one client is requesting at the same time then the thread management is done by tht Container and all the requests are queued and changes are made one after the other. -
Design Issue-Entity vs Session for dbms[ Go to top ]
- Posted by: Kiran Kedlaya
- Posted on: May 16 2001 15:02 EDT
- in response to Sridhar Panatula
Also, if your system encounters a crash/shutdown, entity beans guarantee persistence whereas session beans do not. This would come into question if you have deferred updates.