aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Batch updates using home inerface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Batch updates using home inerface" Watch "Batch updates using home inerface" New topic
Author

Batch updates using home inerface

rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
Hi,
I have been reading HF EJB.
I was reading about entity beans and I found that with entity beans you can have business methods in the entity bens remote home interface and the advantage is for doing "batch updates".


advantage is for doing Batch Updates



This is the thing that I dont upderstand. Batch updates means you are updating the database through a business method but how this batch updates can be achieved.

I know one mechanism of batch updates is by using the PreparedStatement. But as with CMP we dont use JDBC code how this batch updates can be achieved.

Thanks


Rakesh Kadulkar
Nicolas Kal
Ranch Hand

Joined: Sep 09, 2009
Posts: 69
Rakesh,

Since this post is under SCBCD I suppose that you are preparing for the exam.. In order not be surprised when you go for the examination, the exam is targeted on EJB 3 and not EJB 2 that HF EJB is focused. Regarding your question the following is taken from EJB 3 by Orreily

FlushModeType.COMMIT makes sense for performance reasons. The best way to tune a database application is to remove unnecessary calls to the database. Some vendor implementations will do all required updates with a batch JDBC call. If the updateBeds( ) method used the default, FlushModeType.AUTO , then an SQL UPDATE would happen when each query executed. Using COMMIT allows the entity manager to execute all updates in one huge batch. Also, an UPDATE usually ends up in the row being write-locked. Using COMMIT limits the amount of time the transaction holds on to this database lock by holding it only for the duration of the JTA commit.


Regard,
Nicolas


SCJP 6.0 , SBCD (Preparing..),
MSc Enterprise Systems Development, BSc Computer Science
rakesh kadulkar
Ranch Hand

Joined: Jul 24, 2008
Posts: 115
Yes I am preparing for SCBCD but for EJB 2.0 and not for EJB 3.0 for some reasons.

And I am not able to understand the answer that has been given.

What I dont unserstand is how batch update can be done using CMP as you will never put the JDBC Code in CMP Entity bean.



 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Batch updates using home inerface