New dirty-checking options based on bytecode enhancement

Description

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 more efficient (select-before-update not needed) reattachment of enhanced entities.

Environment

None

Status

Assignee

Ståle W. Pedersen

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major