Question

I am using Hibernate 4.3.0.Final / JPA 2.1, Hibernate Search 4.5.0.Final running on WildFly 8.0.0.Final. My application works absolutely fine, but I am getting this hibernate warning when the indexes are being created.

WARN org.hibernate.loader.Loader - HHH000444: Encountered request for locking however dialect reports that database prefers locking be done in a separate select (follow-on locking); results will be locked after initial query execute

This is the method that creates the index:

public void createIndex() throws DAOException {
    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(this.entityManager);

    try {
        fullTextEntityManager.createIndexer(Colaborador.class)
            .purgeAllOnStart(Boolean.TRUE)
            .optimizeOnFinish(Boolean.TRUE)
            .startAndWait();
        }
        catch (InterruptedException e) {
            logger.error("Error creating index", e);
            throw new DAOException(e);
    }
}

I've done some searches and I found a "solution" or, better saying, a way to suppress the warning. However, I don't know if this is the best solution. The solution proposes to extend the org.hibernate.dialect.Oracle10gDialect and override the method public boolean useFollowOnLocking() to return false.

Other important thing: this only happens after Hibernate version 4.2.0.Final. Before this version, there isn't a useFollowOnLocking() method.

The new dialect:

import org.hibernate.dialect.Oracle10gDialect;

public class MyOracle10gDialect extends Oracle10gDialect {

    @Override
    public boolean useFollowOnLocking() {
        return false;
    }
}

I found this solution here and here. There is also a bug report that was reject about this warning. I've not found any other solution available for this warning.

Was it helpful?

Solution

There is no reason to worry about this warning, logging it was a mistake: you should ignore it, or change the logger configuration to ignore it.

I've opened HHH-9097.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top