When Bytecode enhancement is enabled, given:
@Entity @Proxy(lazy = false) public static class User { @Id Long id; String name; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "team_id") UserGroup team; } @Entity @Proxy(lazy = false) public static class UserGroup { @Id Long id; String name; }
User user = session.getReference( User.class, 1 ); user.getName();
should not intialize the User#team association.