Updated data (in Database) is not visible via JPA/Eclipselink

瘦欲@ 提交于 2019-12-02 01:28:37

问题


I have Oracle DB and Java project which is connected to the DB using JPA/Eclipselink.
The problem is that when some data updated in the database (manually using Oracle SQL developer), this data is not visible via JPA, only old values.
What can cause such problems?


回答1:


Please try em.refresh()
JPA's EntityManager will be unaware of any changes you made outside its transaction till it reloads the data. Above command will make it reload the data.

If it is a List (populated using select), then you'll need to reload it.



来源:https://stackoverflow.com/questions/7175044/updated-data-in-database-is-not-visible-via-jpa-eclipselink

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!