• Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Beans/IIOP

 
Elizabeth Reynolds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excuse my ignorance, but working in a standalone environment and being relatively new to J2EE (1-2 years), you miss a lot that you might otherwise pick up on.
With JTA, JDBC, JNDI, and session beans, what exactly is the justification for using Entity Beans? It seems that you could accomplish whatever you would want without them.
 
John Mathew
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I too have the same question.
I believe it has to do with more Component based programming/engineering than anything else. Entity beans does provide a wrapper around your data. CMPs helps you with no SQL, then all that transactional context blah blah..Gurus also say use session beans to talk to entity beans. I basically use Session beans and plain Old Java Objects with SQL.
Thanks
AK
 
Rahul Mahindrakar
Ranch Hand
Posts: 1869
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I agree that perhaps 90% or more implementations use session Beans rather than Entity beans. Our project uses only Stateless session Beans and Entity Beans are a implicit "NO".
But inspite of their low usage Entity Beans model has a relevance when you want "In memory" data. We presently do not have such a requirement and hence we do not use them.
For example lets say that a company has 5000 products which are shown almost on every other page. It would not be advisable to use a database hit to get the details for a user specific query.
We can have 5000 Entity beans which provide the data based on the Finder query.
 
Elizabeth Reynolds
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe I found the justification for entity beans over applications built without them. I developed a sample application that performs several database table updates within one transaction. On a rollback situation, the server just hung, I believe while the rollback was being performed. Totally unacceptable.
Will someone confirm that with entity beans, the rollback of transactions is done in the background? I can probably accomplish the same thing by putting the database updates in a separate thread, but if it's going to get that complicated, then I might as well use entity beans.
Correction, not the server, but the application.
[ July 31, 2002: Message edited by: Elizabeth Reynolds ]
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be no difference between rollback with or without Entity beans. In the end, the very same JDBC code is called, and the very same JTA management is done. If you code is hanging, then you should work that out -- it may be a bug in your JDBC driver, which would certainly not be fixed by moving to entity beans.
Kyle
 
John Fairbairn
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rahul mentioned:
But inspite of their low usage Entity Beans model has a relevance when you want "In memory" data. We presently do not have such a requirement and hence we do not use them.
For example lets say that a company has 5000 products which are shown almost on every other page. It would not be advisable to use a database hit to get the details for a user specific query.
We can have 5000 Entity beans which provide the data based on the Finder query.

We have a need for "in-memory" data in our application. That is, we need to read in data from a database only once and keep it in memory to be accessed by other components at any time while the app server is up. The data won't be changing and there isn't really a need to persist the data to permanent storage. Are entity beans unnecessary in this case?
 
Tim Holloway
Bartender
Posts: 18412
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are about 5 reasons to use EJBs and almost all of them have to do with being able to use a standard, pre-debugged solution instead of developing and debugging your own solution.
Since there is a cost that comes with this convenience, developers have to make their own choices as to when the benefits outweigh the cost - subject to local shop standards, of course.
In the case of Entity EJBs, the two most tangible benefits are to take advantage of the caching mechanism and to provide additional isolation of the database logic from the application's business logic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!