JpaRespository中的自定义连接查询

时间:2017-09-07 18:57:05

标签: java hibernate spring-boot spring-data-jpa jpql

在我的项目中,我有两个实体:competitionuser。用户应该能够观看(最喜欢的)比赛。

@Entity
public class Competition
{
    @Id
    @GenericGenerator(name = "competition_id", strategy = "de.deepsource.jpa.generator.CompetitionIdGenerator")
    @GeneratedValue(generator = "competition_id")
    private String id;

    ...
}

@Entity
public class User
{
    @Id
    private String email;

    ...
}

我通过competitions访问所有PagingAndSortingRepository

public interface CompetitionRepository extends PagingAndSortingRepository <Competition, String>, 
JpaSpecificationExecutor <Competition>
{
}

我通过以下方式获取所有分页结果:

wRep.findAll(spec, pageable)

我现在的问题是:我怎样才能意识到这一点&#34;观看&#34;功能?

0 个答案:

没有答案