I'm trying to use the following code without success:
Code:
FullTextSession fullTextSession = org.hibernate.search.Search.getFullTextSession(
hibernateEntityManagerFactory.getSessionFactory()
.withOptions().tenantIdentifier(myTenantIdentifier)
.openSession()
);
MassIndexer massindexer = fullTextSession.createIndexer();
massindexer.startAndWait();
When the session is opened the "resolveCurrentTenantIdentifier()" method is catched.
This is my CurrentTenantIdentifierResolver class:
Code:
public class HibernateTenantIdentifierResolver implements CurrentTenantIdentifierResolver {
@Override
public String resolveCurrentTenantIdentifier() {
TenancyContext tenancyContext = TenancyContextHolder.getContext();
Tenant tenant = tenancyContext.getTenant();
if (tenant == null)
return DEFAULTSERVICE;
else
return tenant.getServiceDBName();
}
@Override
public boolean validateExistingCurrentSessions() {
return false;
}
I expect that the tenantIdentifier could be fixed by withOptions().tenantIdentifier(myTenantIdentifier), but it does not work!
Is it a bug? Can you help me?
hibernate version: 4.3.5.Final
hibernate search version: 5.0.0.Alpha4
spring version: 4.0.6.RELEASE
thanks,
dario
(italy)