Get Hibernate Search data in flat way instead of relational

Hi friends.
Is there any way to get hibernate search data in flat way instead of relational?

If you mean retrieving the data from the index, yes there is, and it’s called projections: https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#projections

If you mean something else, please explain :slight_smile:

Thanks, I want to get all many to many relations in an array object like join operator in database queries.

Why isn’t retrieving the entities, then going through the getters (getMyManyToManyRelation()) enough for you?

If it’s a matter of performance, you could use the Hibernate Search query to only retrieve the IDs, then pass these IDs as a parameter to a Hibernate ORM query that would perform the joins and return what you want. We don’t have support for JPA’s fetchgraph and loadgraph features.

If it’s something else, then I really need more information, in particular your domain model (the entity classes), a description of the query you want to run, and the code you wrote so far in an attempt to implement this query.

1 Like