4

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?

vamsee
  • 41
  • 3

1 Answers1

2

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.

BobV
  • 4,143
  • 1
  • 18
  • 27
  • I understand that we can override the behavior of isLive but is there an instance where we do want it to check the database? It's not like we can (very easily) disable it per call, like only for findAll and not something else – JoseM Feb 21 '12 at 23:20