File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Why is the need of Entity Beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why is the need of Entity Beans" Watch "Why is the need of Entity Beans" New topic
Author

Why is the need of Entity Beans

rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
Hi,

I dont understand why there is a need of entity beans.

Well entity beans represent the OO representation of the data but it is an unnecessary overhead on the memory as the entiy beans

as objects will be created on the heap.

I can place the JDBC code directly within the session beans. I understand tha for that sake I have to JDBC and SQL but is that the

only reason I have to use Entity beans.

Further it is said that having entity beans in the appication my application can be scalable. But how my application becomes scalable

with having entity beans in my application.

Thanks


Rakesh Kadulkar
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

There is no need for entity beans, they are a legacy technology which was poorly thought out. Does anyone use them any more?

There are arguments for using an ORM technology however, namely:
  • They are database agnostic
  • They remove the need for developers writing lots of low level JDBC boiler plate code
  • They let the developer think in terms of their domain model, not an entity-relational model
  • They tend to be declarative and hence easily changed an configured.



  • I can place the JDBC code directly within the session beans

    This is poor design. You should at least be encapsulating your data access in a DAO layer.


    JavaRanch FAQ HowToAskQuestionsOnJavaRanch
    Christian Dillinger
    Ranch Hand

    Joined: Jul 20, 2009
    Posts: 188
    Are you really talking about the "old" entity beans from EJB2.x or do you talk about Entities from JPA and mixed "beans" in?
    rakesh kadulkar
    Ranch Hand

    Joined: Jul 24, 2008
    Posts: 115
    I forgot to tell here the version but really I am learning EJB 2.0.

    Honestly once this one is finished I will start with EJB 3.0 but for now can some one answer me.

    See I am a trainer and training EJB 2.0 thats why i want to know every picky detail.

    Thanks
    Paul Sturrock
    Bartender

    Joined: Apr 14, 2004
    Posts: 10336

    I would not bother with Enitity Beans even then. Why teach people to use something the shouldn't be using in the first place? No matter:


    Well entity beans represent the OO representation of the data but it is an unnecessary overhead on the memory as the entiy beans

    If you need to use the data in your program it will need to be in memory in one form or another. One of the failings of Entity Beans was their heavy weight nature. They were designed with the idea of managing single object in mind, but most application use data in much larger result sets.


    I can place the JDBC code directly within the session beans

    This is a bad idea, as mentioned earlier.


    Further it is said that having entity beans in the appication my application can be scalable.

    An Entity Bean is an EJB, so shares the same properties of other EJBs, namely it is a distributable component and hence scalable.
    rakesh kadulkar
    Ranch Hand

    Joined: Jul 24, 2008
    Posts: 115
    So should I conclude that Entity beans are never used inthe real time developement enviroment and they are deprecated as

    of EJB 3.0 or if they are deprecated then what is the replacement for them.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Why is the need of Entity Beans