javax.persistence.Entitymanager: remove() method

前端 未结 4 1888
梦毁少年i
梦毁少年i 2021-01-31 19:00

Does remove(Object entity) method of EntityManager work only on those objects got from find() method?

I have following code snippet:

4条回答
  •  死守一世寂寞
    2021-01-31 19:40

    Yes in case of merge or remove operation you have to use a find() operation and then use the remove method on the retrieved entity.

提交回复
热议问题