Hibernate version 5.1.2, same problem. Also @ManyToOne(fetch = FetchType.LAZY), not loading lazy after enhancement. If i annotate many to one with additional @LazyToOne(value = LazyToOneOption.NO_PROXY), then foreign key column will not be loaded with child entity, but in this case call for child.getParent().getId() forces parent entity to load instead of just returing id. It seems that problem is in AbstractEntityPersister class. Its method hasProxy() checks for entityMetamodel.getBytecodeEnhancementMetadata().isEnhancedForLazyLoading(), so if both child and parent entities were enhanced, than no proxy is created and parent will be loaded. |