Gir*_*lle 1 java jpa spring-boot jhipster
我有一件奇怪的事情。当我从我的服务调用一个函数时,该服务丢失了所有参数。我不知道什么时候以及为什么。
调试说当他们进入类时有参数,然后什么都没有。我在另一个服务中做了一个类似的功能,它可以工作。它真的很奇怪。
看(调试打印):
cftimesheet.web.rest.AppUserResource 输入:getAllAppUsersByCompany() with argument[s] = [1, AppUserCriteria{}, Page request [number: 0, size 20, sort: undefined: DESC,id: ASC]]
cftimesheet.web.rest.AppUserResourceREST 请求通过公司 ID 获取 AppUsers:1
cftimesheet.service.AppUserService 输入:findByCompany() with argument[s] = [1, Page request [number: 0, size 20, sort: undefined: DESC,id: ASC]]
cftimesheet.service.AppUserService :请求按公司 ID 获取所有 AppUsers !!!!!!!!!!!!!!!!!!!!! id 丢失的问题
findByCompany() 中的异常原因 = 'java.lang.IllegalArgumentException:org.hibernate.QueryException:无法解析属性:未定义:com.freemind.timesheet.domain.AppUser [从 com.freemind.timesheet.domain 中选择 appUser。 AppUser appUser where appUser.id=?1 order by appUser.undefined desc, appUser.id asc]'
这是代码:
应用用户资源:
@GetMapping("/app-users/company/{id}")//tayo
public ResponseEntity<List<AppUserDTO>> getAllAppUsersByCompany(@PathVariable Long id,Pageable pageable) {
log.debug("REST request to get AppUsers by company id: {}", id);
Page<AppUserDTO> page = appUserService.findByCompany(id,pageable);
return ResponseEntity.ok().body(page.getContent());
}
Run Code Online (Sandbox Code Playgroud)
应用程序用户服务
public Page<AppUserDTO> findByCompany(Long id,Pageable pageable){//?
log.debug("Request to get all AppUsers by company id", id);
return appUserRepository.findByCompany(id,pageable).map(appUserMapper::toDto);
}
Run Code Online (Sandbox Code Playgroud)
查询:
@Query("select appUser from AppUser appUser where appUser.id=?1")
Page<AppUser> findByCompany( Long id, Pageable pageable);
Run Code Online (Sandbox Code Playgroud)
你有什么主意吗?
谢谢。
你的调试语句是错误的
log.debug("Request to get all AppUsers by company id", id);
Run Code Online (Sandbox Code Playgroud)
应该
log.debug("Request to get all AppUsers by company id {}", id);
Run Code Online (Sandbox Code Playgroud)
错误消息说
order by appUser.undefined desc, appUser.id asc
Run Code Online (Sandbox Code Playgroud)
所以问题是 order by 语句,其中有 undefined 。看起来您的分页请求在客户端没有正确形成,这是您应该调查的。
归档时间: |
|
查看次数: |
52 次 |
最近记录: |