I have a problem loading lazy associations by access/navigation with an @Embedded attribute containing an @ElementCollection which is lazy loaded. I'm not sure if the same problem exists elsewhere. Furthermore, if I set a breakpoint in the right spot in debug mode, everything works correctly. Without the breakpoint, my lazy collection does not get loaded. Here are code snippets which should reproduce the problem.
public class Locale extends BaseEntity { ... @Embedded private LocalizedValues names; ... } @Embeddable public class LocalizedValues implements Serializable { ... @ElementCollection // lazy loaded by default private Map<Locale, LocalizedValue> values; ... } @Stateless public class MyServiceBean { ... public Locale getLocaleWithName() { Locale locale = entityManager.find(Locale.class, id); locale.getNames().getValues(); // should load values from DB return locale; // if I set a breakpoint here, values loaded from DB; without breakpoint they are not loaded } ... }