Announcement Announcement Module
No announcement yet.
Solr Plugin Async calls - Session Closed Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Solr Plugin Async calls - Session Closed


    First of all, the Solr plugin for Roo is great and really quickens the integration. The Async feature is also very useful. I've personally overridden the default implementations of the domain object index functions do some more specific indexing and have come across an issue i hope someone can help me with.

    My problem is that inside the Index method, i navigate one-to-many relationships on the domain object which in most cases are lazy and require an open EntityManager session. Now because this is asynchronous ideally a new EntityManager should be created for that thread to stay open for the lifetime of the call (or similar). If i do nothing it seems to use the EM from the web request which is closed at the end of the OpenEntityManagerInViewFilter and can prematurely close it for the async call.

    Anyone have a quick fix solution for this or any suggestions? Any help would be appreciated.


  • #2
    There are a number of workarounds for this issue, but the easiest would be to simply copy your collection into a separate collection and pass that to the asynch solr indexing method. You probably would do that in your controller while the em is still open.


    • #3
      Thanks Stefan.

      You mean to initialize all the collections beforehand? This is actually what i'm doing now as a temporary solution. Problem is that it adds maintenance if those change while Roo would do everything else automatically...

      But I appreciate the suggestion!