aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes newbie question : about EJB and Database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "newbie question : about EJB and Database" Watch "newbie question : about EJB and Database" New topic
Author

newbie question : about EJB and Database

Neha Dhaka
Greenhorn

Joined: Aug 30, 2005
Posts: 29
I am a newbie to EJB ,just have one question in mind,instead of writing session and entity bean and mapping them to tables in distributed application to get database access ,why don't we make the direct calls to the database .
As we generally make calls in web application using DAO, which is also multi tier and distributed application .
whether it due to extra level security which ejb provoides we use ejb,or it is due to Object Relational mapping due to which we
use ejb.
I would be thankful if anybody can clarify.

Raja
Neha Dhaka
Greenhorn

Joined: Aug 30, 2005
Posts: 29
Hi Guys,Please reply!!

Raja
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by Raja Tonk:
I am a newbie to EJB ,just have one question in mind,instead of writing session and entity bean and mapping them to tables in distributed application to get database access ,why don't we make the direct calls to the database .
As we generally make calls in web application using DAO, which is also multi tier and distributed application .
whether it due to extra level security which ejb provoides we use ejb,or it is due to Object Relational mapping due to which we
use ejb.
I would be thankful if anybody can clarify.

Raja

You don't map session beans to tables in a relational database. Entity beans are the Object Relational Mapping component of J2EE. Using EJBs allows access to a range of container provided services (transaction management, security etc.) In my opinion, there is no good reason to use Entity Beans in favour of straight JDBC (via DAOs), however there is a case to use a better ORM technology (such as Hibernate). The pros and cons of this choice have been debated many times before in these forums, I suggest you have a search through them if you want reasons.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Neha Dhaka
Greenhorn

Joined: Aug 30, 2005
Posts: 29
Hi :

Thanks for explaination,I know session bean are not mapped to tables in the database .I would appreciate if you can tell me what should be search criteria for the similer kind of discussion in this forum.


Raja
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Raja,

Hi

I guess your question is whether to use an ejb container or not, or even more, whether one needs a servlet container at all or not. In the former I would recommend you reading this:

http://www-128.ibm.com/developerworks/library/ibm-ejb/

In the later, the answer is very simple and it all depends whether you application needs to be web enabled or not. Otherwise you can use swing and build a client-server application in the old fashion, if this fulfills your company´┐Żs needs.
Regards.


I think, therefore I exist -- Rene Descartes
 
wood burning stoves
 
subject: newbie question : about EJB and Database