【发布时间】:2019-06-05 03:15:50
【问题描述】:
我有下面的方法,它代表两个不同的表,并与一个公共列 domain_id 连接,我的观点是,我不能编写 JPQL 来实现相同的,而不是通过下面的方法东西
@Override
public List<SrityDTO> getByCommonColumn(int id) throws Exception {
Optional<main> ntOptional = ntRepository.findById(id);
if (ntOptional.isPresent()) {
List<rity> rities = rityRepository.findByntDomain(ntOptional.get());
return rities.stream()
.map(SrityDTO::new)
.collect(Collectors.toList());
} else {
throw new Exception(" not exist.");
}
}
【问题讨论】: