|
Below are simple testcase:
SessionBuilder sessionBuilder = hibernateSessionFactory.getFactory().withOptions();
Session session = sessionBuilder.tenantIdentifier("abc-123").openSession();
FullTextSession fullTextSession = Search.getFullTextSession(session);
log.info("ACCURATE DB Tennant ID: " + session.getTenantIdentifier()
+ ", Fulltext Tenant ID: " + fullTextSession.getTenantIdentifier());
fullTextSession.createIndexer().startAndWait();
It shows the following logs:
I can assure it calls my implementation of CurrentTenantIdentifierResolver, to get the "public" tenant ID (because it runs on different thread, my CurrentTenantIdentifierResolver could not get the previous tenant ID, so it returns "public" as default). It should not call the CurrentTenantIdentifierResolver, since the session I'm passing to FullTextSession has already had an tenantIdentifier (see the logs).
|