Question 1:
It probably depends on your server side implemenation.
The with
invocation will only make sure that the corresponding getter (getFoo()
) is called shortly before the RF
call returns to the client.
That's the reason why you also have to make sure to use an OpenSessionInView
pattern, otherwise you might run into NullPointeterException
s.
Question 2:
I guess the Request<T>
implements a builder pattern.
The end-result will be the same.
However I am not sure if the getter()
will be called twice or if the with
method will check if the getter is already requested.
Question 3:
Yes it's the same.
As a sidenote. You can use req.with("foo.bar")
.
On the backend this will lead to a getFoo().getBar()
call.