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

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.
 
Proudly marching to the beat of a different kettle of fish... while reading this tiny ad
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!