aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes Entity Beans ejbStore and ejbLoad over head Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Entity Beans ejbStore and ejbLoad over head" Watch "Entity Beans ejbStore and ejbLoad over head" New topic
Author

Entity Beans ejbStore and ejbLoad over head

venkat kondarapu
Greenhorn

Joined: Jul 22, 2004
Posts: 5
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???....


SCJP
friso dejonge
Ranch Hand

Joined: Jul 11, 2002
Posts: 162
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.


swimming certificate (A & B), shoelaces diploma, and some useless java ones.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312

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.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8876

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


Groovy
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
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

Joined: Mar 06, 2001
Posts: 1209

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

Joined: Feb 27, 2002
Posts: 8876

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Entity Beans ejbStore and ejbLoad over head
 
Similar Threads
REG:Performance issues in Entity Bean with JBOSS
Bean managed Transaction for Entity Beans
ejbStore() and ejbLoad() in Entity Beans
Can we write Entity Bean for a table which does not have a Primary Key defined?
BMT with Entity beans