Improve detection of entity state#3604
Conversation
Hibernate use 0 or user provided positive initial value as seed of integer version. EclipseLink always use 1 as seed of integer version.
| return super.isNew(entity); | ||
| } | ||
|
|
||
| BeanWrapper wrapper = new DirectFieldAccessFallbackBeanWrapper(entity); |
There was a problem hiding this comment.
Does this work when entity is a proxy?
I'd like an integration test, that ensures it has a proxy an based on that tests the isNew method.
There was a problem hiding this comment.
I don't understand why it's related to proxy, could you expand?
There was a problem hiding this comment.
The entity might be a Hibernate proxy. And I basically don't trust any code to properly work with those. Just the normal paranoia after working with JPA to much.
There was a problem hiding this comment.
I'm not expert of proxy, as far as I know, proxy only take care of accessing lazy attributes and associations, version is not in that case, and this PR only reuse the existing code wrapper.getPropertyValue(it.getName()) to get value of version to refine the logic.
52ee55f to
61e6d36
Compare
Hibernate use 0 or user provided positive initial value as seed of integer version.
EclipseLink always use 1 as seed of integer version.