各位前辈,第一次用SpringJPA。现在实体类有一个字段是这样的:privateStringmovie_id;而我想通过这个字段排序,继承PagingAndSortingRepository后,代码为:Sortsort=newSort(Sort.Direction.DESC,"movie_id");Pageablepageable=PageRequest.of(0,PAGE_LIMIT,sort);PagemovieInfopage=movieInfoRepository.findAll(pageable); 可是报错了:org.springframework.data.mapping.PropertyReferenceException:NopropertymoviefoundfortypeMovieInfo!atorg.springframework.data.mapping.PropertyPath.(PropertyPath.java:92)~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE] atorg.springframework.data.mapping.PropertyPath.create(PropertyPath.java:356)~[spring-data-commons-2.0.6.RELEASE.jar:2.0.6.RELEASE]手动改movie_id为movieId后即可操作。那肯定是框架无法识别下划线....前辈们咋办!可以不用大改字段名么?
慕桂英4014372
相关分类