This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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.



 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Batch updates using home inerface
 
Similar Threads
EJB lookup and Jboss SEAM
Design Decision help needed
cachefullexception while Entity bean Create
Regarding batch updates in entity bean
choosing between home business methods and finders