• Post Reply Bookmark Topic Watch Topic
  • New Topic

merge issue in EJB3.0  RSS feed

 
padma warlu
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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!