JPA: Does EntityManager.find() always return the same object reference for the same key?

后端 未结 2 1885
甜味超标
甜味超标 2021-01-20 16:29

I\'ve got an integration test of a DAO in which I use a shared EntityManager (via Spring, using SharedEntityManagerCreator). The test class is marked as @Transactional, as

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 17:15

    No it does not. You should rely on object EQUALITY instead of IDENTITY anyway. Override the equals method.

提交回复
热议问题