• Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Beans ejbStore and ejbLoad over head  RSS feed

 
venkat kondarapu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
I have got a question on entity beans.
As of my knowledge, ejbLoad and ejbStore are called before and after every business method is invoked.do any of you guys think that this is kind of over head on container when we need small update on a table.my question is ,
why do we go for entity bean when we need small update on table.we can do this using normal JDBC and java beans right???....
 
friso dejonge
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As of my knowledge, ejbLoad and ejbStore are called before and after every business method is invoked.do any of you guys think that this is kind of over head on container when we need small update on a table.my question is ,why do we go for entity bean when we need small update on table.we can do this using normal JDBC and java beans right???....


all true. To check this, just use log4j e.g. and print out something to the log from those methods. Then you will indeed see how often they are called. So if they are called too often then the persistence is still in the database and a stateless session bean making the axact same call would do the same, but then only when explicitly called.

This seems all true, however i also think that the above issues, how often the store and load are called depend on the provider of the container.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ejbLoad and ejbStore are called before and after every business method is invoked


ejbLoad and ejStore method are call by EJB Container which it's more transaction / security management.

If you want to use jdbc for update/insert small data, i think you can use but if this table is very important in application or this process want to manage more transaction/security , so you much careful in this process.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The new EJB 3.0 version will not have ejbLoad/ejbStore methods.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by venkat kondarapu:
Hi Guys,
As of my knowledge, ejbLoad and ejbStore are called before and after every business method is invoked.


I doubt if it gets called before and after every business method.
I thought ejbStore gets called at the final transaction commit.
Say, you have a session facade with tx marked as 'required' and Entity beans with tx marked as 'required' as well. You might invoke n business methods on a bean while within a session bean transaction. At the end of it, all the affected beans ejbStore will be called.
Can somebody confirm this?.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The new EJB 3.0 version will not have ejbLoad/ejbStore methods.


Yes, I think one of nice things is the support for detached (beans) and the save has to explicitly initiated through the EntityManager?
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought ejbStore gets called at the final transaction commit.


You could configure the server to call the ejbStore/Load method after each business method. The spec clears mentions that the bean developer should be prepared for such a suitation even though it is rarely needed. Most app servers by default invokes after the Tx commit.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!