aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Using entity beans in project 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 "Using entity beans in project" Watch "Using entity beans in project" New topic
Author

Using entity beans in project

kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Hi All
I am confused why we use entity bean when we can do everything using stateless session bean and dataaccessobject.Why we need an object oriented view of tables.
PLs clarify
candy


SCJP1.4,SCBCD,SCEA,CNA
Failures are practice shoots for success.
Augg Stine
Greenhorn

Joined: Mar 24, 2004
Posts: 27
Hi,
it is all because of a big boss "Container".
In a table, if i have 100 fields, i can tell the container to take care of any no. of fields. So that the container takes cares of those fields i.e. the container is responsible for their persistence, their isolation level, transaction etc ..
kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
Hi Augg
What do u mean by container takes care of everything.It only takes care of update and other query we have to write with EJBQL.And performance wise entity beans are not so good.
And ultimately isolation level of database is used.
Give some more solid logic for using Entity beans
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
It's pretty simple really. You will write only about 1/10 of the code if you use Entity beans than if you write your own DAO's. It's much, much simpler to use Entity beans.
And performance isn't always a critical factor. Entity beans perform well enough for many, many applications. Even applications where speed is critical could use them for parts of their application -- speed is usually only critical in a few use cases out of many.
It's a tradeoff of programmer effort for runtime performance, plain and simple.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Augg,
Thanks for joining JavaRanch, but could you take a quick look at the naming policy and edit your profile accordingly.
kundan varma
Ranch Hand

Joined: Mar 08, 2004
Posts: 322
HI Kyle
BUt dont u think its more easier to use sessionbean and dataacceessobject than entity beans.And also if Entity beans are not complicated then why the concept of JDO with session bean is coming up so fast.
Plz clarify
THanks
candy
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi candy,

BUt dont u think its more easier to use sessionbean and dataacceessobject than entity beans.

According to me only if we have used both approaches for a while, we would be able to gauge what works better for a project. Nothing is a "silver bullet" you know.
On serverside.com you would find long dicussions about this topic. I remember myself reading it and now I don't recall the url but surely good would help you find that
Regards
Maulin
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Originally posted by candy varma:
HI Kyle
BUt dont u think its more easier to use sessionbean and dataacceessobject than entity beans.And also if Entity beans are not complicated then why the concept of JDO with session bean is coming up so fast.
Plz clarify
THanks
candy

No, I don't think using DAO's are easier than Entity beans -- quite the opposite in fact. If you'd sit down and try to write a few yourself you'd come to the exact same conclusion. The reason why JDO's are so popular is that they give the exact same object to relational database mapping capabilities of cmp's without the security and transactional control aspects of ejb's that many people feel are extraneous -- but that honestly don't get in your way that much.
Kyle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using entity beans in project