Here is the defination of the program which i m facing.
My design goes something like this. A session bean's business method which is acessing the EntityBean to update the fields. Here i m not mentioning the transaction type for any of the bean's method. The underlyig table of the entity bean(CMP) is very huge having around 60-70 fields. Now when i m executing the biz method of the session bean which is updating some 20-30 fields of the bean this method takes more then a min. to complete execution. Later i found out that everytime a execute the a metod of the bean ejbLoad() as well as ejbStore() method of the entity bean gets called which is taking time since the table to be loaded is very huge.
Is there some way like changing trans attrib, in which i can restrict this and make ejbStore() of the bean called only when the bizmethod i.e. actual transaction is over.
Looking at this behaviour i have another question
suppose in a method i m updating 10 fields of the bean that means i would be calling 10 setter methods if the ejbLoad and ejbStore is called after every method so if there is some error on the updation of the field # 5 does it properly rollback the previously updated values. The question is beacause it calles ejbStore after every method.
Thanks
Desperatly waiting for your reply
Sachin
sachinshah@hotvoice.com
-
Help Needed urgently (6 messages)
- Posted by: sachin shah
- Posted on: February 02 2001 09:02 EST
Threaded Messages (6)
- Help Needed urgently by raghu tss rao on February 02 2001 13:59 EST
- Help Needed urgently by sachin shah on February 03 2001 02:49 EST
- Help Needed urgently by sahil gupta on February 02 2001 16:55 EST
- Help Needed urgently by sachin shah on February 03 2001 02:50 EST
- Help Needed urgently by Web Master on February 06 2001 03:57 EST
- Help Needed urgently by sachin shah on February 03 2001 02:50 EST
- Help Needed urgently by Stephen Davies on February 11 2001 16:57 EST
-
Help Needed urgently[ Go to top ]
- Posted by: raghu tss rao
- Posted on: February 02 2001 13:59 EST
- in response to sachin shah
Use bulk accessors to get and set your feilds.
See the patterens section for more details
-
Help Needed urgently[ Go to top ]
- Posted by: sachin shah
- Posted on: February 03 2001 02:49 EST
- in response to raghu tss rao
Hello Raghu
I m not much experienced to EJB developement. so can you please help me how to use this bulk accessors.
Thanks -
Help Needed urgently[ Go to top ]
- Posted by: sahil gupta
- Posted on: February 02 2001 16:55 EST
- in response to sachin shah
put db-is-shared to false to restrict calls to ejbload but only if u'r database is indeed not shared and write the code for isModified to store the contents only if the contents have changed from the previous value. This will restrict the calls to ejbStore. -
Help Needed urgently[ Go to top ]
- Posted by: sachin shah
- Posted on: February 03 2001 02:50 EST
- in response to sahil gupta
Hello Sahil,
Where can i set this property.
Thanks
-
Help Needed urgently[ Go to top ]
- Posted by: Web Master
- Posted on: February 06 2001 03:57 EST
- in response to sachin shah
You have a better choice to do this task. You should use a detail bean into your EJB, and use only the set and get of this attribute. With this, you will avoid that each time you use a set method the container calls ejbLoad(). If your DB is used only by your application you can use a flag called isModified and when you detect you have changed the detail bean you must put the flag to true. And in the ejbStore() method you can decide if you want to do the storing operation or not.
Maybe with this you will be able to perform better your task. -
Help Needed urgently[ Go to top ]
- Posted by: Stephen Davies
- Posted on: February 11 2001 16:57 EST
- in response to sachin shah
Sachin,
getting a load/store on every entity method call means that the methods are executing in their own transaction. Declare container managed transactions something like this:
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>MySessionBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>MyEntityBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
This means the container will start a transaction when the session bean method is called. The 70 or so entity set methods will all shar the same transaction, you should see a single load/store.