wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Entity Manager flush() doubt 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 "Entity Manager flush() doubt" Watch "Entity Manager flush() doubt" New topic
Author

Entity Manager flush() doubt

Aditya Vasudeva
Ranch Hand

Joined: May 27, 2008
Posts: 76
I have a question i cant answer :


A Java Persistence application uses the EntityManager.flush method to synchronize the current
persistence context with the database. Which two statements are correct? (Choose two.)

A. The flush method might cause the persist operation to be cascaded to related entities.
B. Extensive use of the flush method decreases the performance of a Java Persistence
application.
C. The flush method should be used to synchronize the current persistence context with
modifications made in other transactions.
D. The flush method should be used to publish changes done in the current persistence context
to other transactions before actual transaction commit


What should the answers be ? Should'nt one of them be option D??
Please explain as to why you chose your options...
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Hi,
the flush operation makes effective any pending entity manager operation.
But if you are working into a transaction, that effectiveness is not seen by other transactions until commit.
I would exclude the C option, too for obvious reasons.


SCJP<br />SCWCD 1.4 Upgrade (Remember: me stupid)<br />SCWCD 1.4<br /><a href="http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html" target="_blank" rel="nofollow">SCBCD 5.0</a><br /><a href="http://www.enthuware.com" target="_blank" rel="nofollow">SCBCD 5.0 mock exam</a> <br /> <br />SCEA 5 Part1: Preparing...
Vinay Nath
Ranch Hand

Joined: Jul 06, 2008
Posts: 85
I would say B and D,

A, I m not sure about it. but C, I agree with Mirko.


SCDJWS 5.0, SCBCD 5.0, SCWCD 5.0, SCJP 5.0
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Surely! A and C are incorrect.
A is incorrect because of what I have written in my previous message.
[ July 14, 2008: Message edited by: Mirko Bonasorte ]
krishna bulusu
Ranch Hand

Joined: Aug 28, 2006
Posts: 185
flush() would make the entity synchronize with the database. So, How C and D comes into picture.
A is one Answer. But I don't think C and D are correct. So, B may e the other Answer.
Am I correct?


Thanks&Regards, Krishna.
SCJP1.4, SCWCD1.4, SCBCD 5.0
Mirko Bonasorte
Ranch Hand

Joined: May 14, 2007
Posts: 244
Excuse me,
I have made confusion with another post.
Sure, C and D are incorrect.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Entity Manager flush() doubt