有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

使用QueryDsl的java Spring引导

我正在使用QueryDsl和分页创建一个Restful项目。这是剪贴我的代码:

存储库接口

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

 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());

当我使用postman运行我的项目和测试时,我在eclipse中看到一条消息并得到一个错误:

o.h.h.i.QueryTranslatorFactoryInitiator : HHH000397: Using ASTQueryTranslatorFactory

java.lang.NullPointerException

如何解决这个问题?我们可以在QuerydslPredicateExecutor执行时显示生成的查询吗


共 (1) 个答案

  1. # 1 楼答案

    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.