• 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

merge issue in EJB3.0

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic