简体   繁体   中英

Using EntityGraph with Hibernate Search ORM

I'm trying to eliminate loading of unnecessary data when I find some entities using Hibernate Search ORM . The projections mechanizm provided by the framework is not convinient because of it's limitations(eg all the data you need must be stored in index).

Is there any way to use an EntityGraph for loading entities with FullTextEntityManager ?

It would be easier to define most of your relations as lazy, and use an entity graph when you need to fetch more.

Hibernate Search does not allow to use an EntityGraph , at least not yet, but it allows you to set a Criteria object on your query, and you can use org.hibernate.Criteria#setFetchMode to disable fetching for some associations.

See https://docs.jboss.org/hibernate/search/5.11/reference/en-US/html_single/#_fetching_strategy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM