A bytecode enhanced entity with lazy loaded properties (@Basic or @Formula or @OneToMany) yields the stale values for the properties when accessing them after calling entityManager.refresh on the entity.
I found this in version 5.4.2 while migrating an app from 3.6.0. This was not a problem in 3.6.0. From debugging, it appears the problem was introduced by a change to PojoEntityTuplizer in revision 1e44e74. The
LazyAttributeLoadingInterceptor for the entity still retains its list of initalizedLazyFields after the entity is refreshed.
Test case is attached. If you'd rather have me submit a pull request with the test case added to a fork of the project, let me know.