We're updating the issue view to help you get more done. 

Initial improved bytecode enhancement support


Introduce org.hibernate.engine.internal.EntityEntryContext, org.hibernate.engine.spi.ManagedEntity, etc as a means to allow increased performance for Session-related memory and CPU overheads.

org.hibernate.engine.internal.EntityEntryContext is a context for maintaining the relation between an entity associated with the Session owning this EntityEntryContext and that entity's corresponding org.hibernate.engine.spi.ManagedEntity reference.

org.hibernate.engine.spi.ManagedEntity is a contract for describing an entity's association with a Session. It gives us access to information (specific to each entity instance) such as it's org.hibernate.engine.spi.EntityEntry as well as defining a doubly-linked graph via org.hibernate.engine.spi.ManagedEntity#$$_hibernate_getPreviousManagedEntity and org.hibernate.engine.spi.ManagedEntity#$$_hibernate_getNextManagedEntity

There are 2 forms of org.hibernate.engine.spi.ManagedEntity supported. First is for the entity to implement the ManagedEntity interface, either directly or through bytecode manipulation. Second is for Hibernate to "wrap" the entity in a ManagedEntity implementation (legacy Hibernate did this anyway, in terms of wrapping the entity as it was added to IdentityMap).

An Ant task to perform enhancing was added here as well. Gradle and Maven support are tagged in and HHH-8337, respectively.

See for follow-on tasks...

Initially, this issue started as an investigation into expanding bytecode enhancement support to cover a variety of topics such as

  • removing load (EntityEntry, etc) from PersistenceContext - important in removing reliance on IdentityMap and reducing Session-related memory and CPU overheads

  • dirtiness handling

  • lazy initialization - both through interception and through generated "proxies" (generated class)

  • bi-directional association management

  • anything else?

The first bullet above is the feature implemented here. The other bullets have all moved to and its sub-tasks.





Steve Ebersole


Steve Ebersole


Fix versions