• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

EJB3 in Action errata for EntityManager.refresh() method

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following section is from EJB 3 in Action page 299.

"An entity can become attached to the EntityManager’s context when you pass the entity to the persist, merge, or refresh method."

Does the entity get attached to the persistence context when it passed to the refresh() method or is this an error in the book?

Thanks in advance.
 
Sheriff
Posts: 6611
1253
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which makes you to think that the entity will not get attached to the PC by the refresh() method?
And, "Tyronne Fernando", is that your real name?
 
Tyronne Fernando
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code and text is from page 332 of EJB 3 In Action:

public Item undoItemChanges(Item item) {
entityManager.refresh(entityManager.merge(item));
return item;
}

"The merge operation is performed first in the undoItemChanges method because the refresh method only works on managed entities."

Because of this, I get the impression that the refresh() method does not attach the entity to the persistence context.

.... and Tyronne Fernando is my real name
 
    Bookmark Topic Watch Topic
  • New Topic