http://in.relation.to/Bloggers/OptionsForEntityDirtnessChecking is a great discussion of the current state.
The basic idea with this feature is to allow the entity to dirty-check itself through bytecode enhancement as discussed in the Tracked approach : bytecode enhancement section. So in part the code will simply be moved over from org.hibernate.bytecode.internal.javassist.JavassistClassTransformer to org.hibernate.bytecode.enhance.spi.Enhancer.
But also, the other part is to allow different ways to request the checking be done. Some options we discussed were:
- instance checking (with ==) - by far the most performant option, but not feasible in cases where the state of the thing being checked can mutate internally
- Hibernate Type checking - The Hibernate org.hibernate.type.Type for the changing attribute would be used to perform the equality check
A related consideration is having the entity track its loaded state. This would allow for better reattachment of enhanced entities.
|