Say I have a database, with types A and B. A is an EntityProxy which contains a list of B, and B is a ValueProxy. I useGWT’s RequestFactory to query A by id. When I query for an A using RequestFactory, I can access the list of B like so: A.getB(), since B is a `ValueProxy’.
Question: is the B list actually queried and downloaded to the client at the time I query for A, or only when I call getB()?
There’s no lazy-loading: you ask for “A with Bs”, you get “A with Bs”, if you ask only for A (because you don’t use
.with("b")on yourRequest), you’ll get only A, and you’ll have to ask for Bs later.See it as the principle of least surprise.
Note that getting the Bs from your database (you tagged the question with Hibernate, JPA and ORM, so…) is a different story. It depends how you manage your EntityManager session and JPA entities’ lifecycle. It might very well be the case that the Bs are loaded from the database even though they’re not being sent to the client.