Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity Manager flush() doubt

 
Aditya Vasudeva
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Vinay Nath
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would say B and D,

A, I m not sure about it. but C, I agree with Mirko.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excuse me,
I have made confusion with another post.
Sure, C and D are incorrect.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic