Spring 按父母的礼节举行春季聚会

Spring 按父母的礼节举行春季聚会,spring,jhipster,findall,Spring,Jhipster,Findall,我正在使用JHipster生成一个应用程序。我有这张地图:Arquivo和Tabela有一对夫妻关系。塔贝拉和坎波只有一段恋情 Arquivo有一个名为“versao”(字符串)的属性。我想做一些类似的事情: Page<Campo> findAllByArquivoVersao(String versao, Pageable pageable); Page findallbyarquivorsao(字符串versao,可分页); 但我收到了这个错误: 无法为方法public ab

我正在使用JHipster生成一个应用程序。我有这张地图:Arquivo和Tabela有一对夫妻关系。塔贝拉和坎波只有一段恋情

Arquivo有一个名为“versao”(字符串)的属性。我想做一些类似的事情:

Page<Campo> findAllByArquivoVersao(String versao, Pageable pageable);
Page findallbyarquivorsao(字符串versao,可分页);
但我收到了这个错误:

无法为方法public abstract org.springframework.data.domain.Page br.com.app.repository.CampoRepository.findallbyraquivorsao(java.lang.String,org.springframework.data.domain.Pageable)创建查询!未找到Campo类型的属性


我可以做一些类似FindAllByTableed的事情…所以我的映射是正确的。如何按父项的父项属性进行查询筛选?

选项1

Versao从
ArquivoRepository
中找到您的Arquivo,然后调用
Arquivo.getTabelas()
getCampos()
,以获取您想要的campo集合

选项2

camporeposition
中定义自己的
@Query
,如下所示:

@Query("select c from Campo c where c.tabela.arquivo.versao = :versao")
Page<Campo> findAllByArquivoVersao(@Param("versao") String versao, Pageable pageable);
在不知道您是如何设计实体的情况下(抓取、可空性等等),我只能猜测到这一点

我没有测试任何代码。

我得到了它。第4.4.3项中规定了这种情况:


我必须这样命名我的接口方法:findByTabelaArquivoVersao

尝试
findByArquivoVersao
(没有
All
word)我尝试过。相同的错误…可能重复的
@Query("select c from Campo c where upper(c.tabela.arquivo.versao) like concat('%',upper(:versao),'%')")
Page<Campo> findAllByArquivoVersao(@Param("versao") String versao, Pageable pageable);