feliperazeek / playframework-elasticsearch

Integrate Elastic Search in a Play! Framework Application. This module uses JPA events to notify Elastic Search of events of their own. It embeds a running Elastic Search instance for Rapid Development.
http://geeks.aretotally.in/play-framework-module-elastic-search-distributed-searching-with-json-http-rest-or-java
84 stars 43 forks source link

Including a list of related entities in the Elasticsearch index #73

Open preslavrachev opened 11 years ago

preslavrachev commented 11 years ago

Using the elasticsearch module, is it possible to somehow index the results of a related collection, which is lazy-loaded?

I have a model type Book, which has many Authors, which are lazy loaded

If I annotate the list of authors as @ElasticSearchEmbedded, I get the following exception:

org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: models.Book.authors, no session or session was closed If I mark it as ignored, of course everything goes fine. Is there a way to at least get the names of the authors in the Book index?

preslavrachev commented 11 years ago

In general, how do I embed related collections of models? I do not really want to ignore them or mark them as FetchType.EAGER