1. The javadoc of StatelessSession states that "a stateless session does not [...] interact with any second-level cache", meaning that maybe our "cacheable" parameter makes no sense? Also, the "cacheable" parameter in the Criteria API seems to ultimately instruct hibernate to use org.hibernate.loader.Loader.listUsingQueryCache(SharedSessionContractImplementor, QueryParameters, Set<Serializable>, Type), which seems to simple cache query results, which has nothing to do with entity caching, so I'm not sure how this would help.
2. The javadoc of StatelessSession states that "Collections are ignored by a stateless session": what if we want to index a collection? Does it even work?
3. Did we make sure to use read-only transactions? => We dont use transactions, at least not explicitly. We might revisit this topic in HSEARCH-2611.
4. We do have a fetch size parameter, but do we check that it's lower than the partition size? It may be a good idea... => The queries are bounded, so a fetch size higher than the partition size is no problem.