Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
541 views
in Technique[技术] by (71.8m points)

jpa - requestfactory and findEntity method in GWT

I am trying to use RequestFactory. My ORM provider is JPA. I have a method to retrieve a list of entity called findAll(). When the user requests for a list of entities, findAll is called. Find all executes a query against database and returns a list of entities. However, when requestFactory is asked to send this list back to the user, requestfactory calls findEntity() for each entity in the list.

My question is: is there any way I can instruct request factory to not call find entity for each item in the list?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is likely from SimpleRequestProcessor.createReturnOperations() determining whether or not your domain objects are live, in order to send the appropriate Delete, Persist, or Update WriteOperation value. The default implementation of ServiceLayer.isLive() calls the finder method to determine if the object can be re-loaded. You can provide your own subclass of ServiceLayerDecorator that overrides the isLive() method by subclassing RequestFactoryServlet and calling the multi-arg super-constructor.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...