简体   繁体   English

使用QueryDsl的Spring Boot

[英]Spring Boot with QueryDsl

I'm create a project Restful using QueryDsl and Pagination. 我使用QueryDsl和Pagination创建一个Restful项目。 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 : 当我运行项目并使用邮递员进行测试时,我在eclipse中看到消息并收到错误消息:

ohhiQueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory ohhiQueryTranslatorFactoryInitiator:HHH000397:使用ASTQueryTranslatorFactory

java.lang.NullPointerException java.lang.NullPointerException

How to resolve this ? 如何解决呢? We are can show query generated when QuerydslPredicateExecutor excute ? 我们可以显示当QuerydslPredicateExecutor执行时生成的查询吗?

We are can show query generated when QuerydslPredicateExecutor excute ? 我们可以显示当QuerydslPredicateExecutor执行时生成的查询吗? 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. 该配置中有datasource部分,您可以在show / hide查询中指定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM