@PersistenceContext
private EntityManager em;
...
   em.persist( entity1 );
   em.merge( entity2 );
   em.find( MyEntity.class, id );