I noticed that when I invoke
SomeProxy proxyNew = someRequestContext.edit(proxyOld);
proxyNew.setSomething(somethingNew);
someRequestContext.mySaveMethod(proxyNew).fire();
The entity returned from
@Override //from Locator<SomeEntity ,IdClass>
public SomeEntity find(Class<? extends SomeProxy > clazz, IdClass id) {
...
}
is used in server when saving method is invoked and only those property/istance variable values of proxyNew are transfered to server implementation mySaveMethod(SomeEntity entity)
which are new in comparison with the returned entity.
Now. I understand that there is some comparison in order to provide server side only with deltas so there is efficiency in communication but I think it is somehow offset by additional processing/transfer time needed by implementation of public SomeEntity find(Class<? extends SomeProxy > clazz, IdClass id)
which retrieves the entity objects from database.
My question now is, how should this be correctly implemented in system with persistence services exposed via stateless session bean which provide services to GWT server side servlets/DAO objects. Correctly implemented in a way that the highest efficiency and lowest waiting time is achieved. Also could someone explain to me this RequestFactory aspect/process in greater detail?
My example: I retrieve OrganizerEntry
entities from persistence layer for a certain day span - a week.
So the method like
retrieveOrganizerEntries(Date from, Date to)
is invoked in persistence layer.
Then I see that for each OrganizerEntry
entity object obtained which is to be sent to the client layer, another query is made, like retrieveOrganizerEntry(int id)
.
So not only are the same objects queried twice, but the second time they are queried one by one in a very inefficient manner.
How can this be improved? Should I cache in DAO/servlet objects somehow the results from first query and let public SomeEntity find(Class<? extends SomeProxy > clazz, IdClass id)
search the cache? Is it way to go to implement this method returning null
or
newly created empty entity (new OrganizerEntity()
) and before invoking the persist/save method from the client just setting every single property/instance variable value?
Where can I find more examples and explanation about this stuff? Because http://www.gwtproject.org/doc/latest/DevGuideRequestFactory.html seems to me not very exhausting .