• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

merge issue in EJB3.0

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If i would like to update the data using entitymanager.merge, do i need to first find the object by using em.find(xxx.class,id) and set the modified data to the retrieved object and then call em.merge(POJO).

eg.
Employee employee = em.find(Employee.class,"E1001");
employee.setName("asdf");
employee.setSalary("2323");
em.merge(employee);

OR

what if i pass the updated POJO and without using em.find, if i directly use em.merge(POJO), will it be a problem?

eg.
em.merge(employee);

Pls suggest which patten should i follow.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!