• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why is the need of Entity Beans

 
rakesh kadulkar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
     
    Christian Dillinger
    Ranch Hand
    Posts: 197
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 115
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 10336
    Eclipse IDE Hibernate Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 115
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic