Do not inject CollectionTracker into entity without collection

Description

I have the following entity

@Entity @Getter @Setter public class Pupil { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQUENCE") @SequenceGenerator(name = "SEQUENCE", sequenceName = "PUPIL_SEQ", allocationSize = 5000) private Long id; @Column private int age; @Column private String name; @Column private LocalDate enrolled; public Pupil() { } }

after instrumentation this entity contains

private transient CollectionTracker $$_hibernate_collectionTracker;

which is redundant as entity does not have any collection field.

Activity

Show:

Former user September 12, 2017 at 9:15 PM

Fixed in master.

Luis Barreiro September 7, 2017 at 6:03 AM

PR with fixes for both Javassist and ByteBuddy enhancers: https://github.com/hibernate/hibernate-orm/pull/1963

Sergei Tsypanov June 22, 2017 at 9:39 PM

Also it's interesting that the field is assigned after entity becomes persistent. See attached screenshots
screenshot before save
screenshot after save

Sergei Tsypanov June 22, 2017 at 8:04 PM

Sure, it's just a minor enhancement. It'd not give any significant performance improvement.

Luis Barreiro June 22, 2017 at 3:19 PM

Although is technically possible to remove the field, at this moment it would add some complexity to the enhancer. Let's keep this open for future reference.

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created June 15, 2017 at 7:47 AM
Updated September 13, 2017 at 6:25 PM
Resolved September 12, 2017 at 9:15 PM

Flag notifications