Suppose I have 2 entities, EntityA and EntityB.
EntityB is @OneToOne
related to EntityA:
@Entity
public class EntityB {
@OneToOne(fetch = FetchType.LAZY)
private EntityA entA;
// other stuff
}
When I load EntityB from DB, the corresponding EntityA (say entA1) is lazy loaded.
After that I load EntityA list by
List result = entityManager.createQuery("select A from EntityA A")
.setFirstResult(start).setMaxResults(end).getResultList();
The result list contains both previously lazy loaded and proxied EntityA and normal materialized EntityAs such like:
EntityA
EntityA_$$_javassist_nnn <--- entA1 which is loaded lazily earlier
EntityA
...
So my questions:
1) Is this an expected behavior? Where can I find apidoc info about that?
2) Can I entirely load proxied entities only or entirely load eagerly all of them? Not mixed.