I have an method in DAO like below, 

```
public void updateEntity1(Entity2) {
     Entity1 = entitymanager.find(....);
     Entity1.setAttr(Entity2.getAttr());
     .........
     entitymanager.merge(Entity1);
     em.flush();
}

```

I want update entity1 with the value entity2 contains, at the end of the method, I find entity1's attr updated successfully, but the in database it didn't changed?
Is there any thing wrong with this method?