why to use entity bean if session bean can do all?
1 posts in topic
Flat View  Flat View

Posted By:   akshat_n
Posted On:   Monday, September 8, 2003 11:25 PM

Stateful Session bean can store the client state in temparory storage. Session bean can connect to database and can even call stored procedures. Session can even use callback methods using SessionSynchronization interface. So it seems to be just one drawback of using session bean is that, it makes single session bean object for single client whithout making it sharable for all the client. beside this why shall we use entity bean if all we can do using session bean?

Re: why to use entity bean if session bean can do all?

Posted By:   Amir_Pashazadeh  
Posted On:   Thursday, September 18, 2003 05:22 AM


I believe you didn't understand what are Entity EJBs for.

It is true that Session EJBs can access to db directly without Entity EJBs (for example using JDBC), but JDBC is not an OO way, and the maintenance will be very hard using JDBC instead of some kind of Object-Relational mapping (EJBs, JDO, or even DAO), and even a small change to db-schema will cause a lot of changes in Java codes.

By the way when using Entity EJBs your codes will be seperated from db-access codes, which are ugly, hard to maintain and error-prone.

Amir Pashazadeh

About | Sitemap | Contact