• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Entity Manager flush() doubt

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Excuse me,
I have made confusion with another post.
Sure, C and D are incorrect.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic