简体   繁体   中英

Spring Boot with QueryDsl

I'm create a project Restful using QueryDsl and Pagination. This is snip my code :

Repository interface

@Repository
    public interface PrsMainRepo extends PagingAndSortingRepository<PrsMain, String>, QuerydslPredicateExecutor<PrsMain> {
    }

and

 builder = new PrsMainPredicateBuilder();
    for (SearchCriteria param : body) {
          builder.with(param.getKey(), param.getOperator(), param.getValue());
        }
  // builder.build()=> prs_main.prs_firstname = 'Sharon'
    Iterable<PrsMain> main = prsMainRepo.findAll(builder.build());

When i run my project and test with postman , i see message in eclipse and get an error :

ohhiQueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory

java.lang.NullPointerException

How to resolve this ? We are can show query generated when QuerydslPredicateExecutor excute ?

We are can show query generated when QuerydslPredicateExecutor excute ? For this you have to change configuration in your application configuration file. There is datasource section in that configuration and you can specify inside show/hide the query.

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