EclipseLink, lazy fetch collection is accessible outside of transaction
问题 I have an entity named User which has the following field called roles : @ManyToMany @JoinTable( name = "user_role", joinColumns = {@JoinColumn(name = "user_id", nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "role_id", nullable = false)} ) private List<Role> roles; I load the User via the use of a service method and the service method is wrapped in a transaction (JTA). After calling the service method and retrieving the User , I access this role field outside of the transaction