public interface Idsonly { Integer getId(); String getOtherId();}
并使用本机查询,例如;
@Query(value = "Id, OtherId from TestTable where CreationDate > ?1 and Type in (?2)", nativeQuery = true) public Collection<IdsOnly> findEntriesAfterDate(Date creationDate, List<Integer> types);
查看https://docs.spring.io/spring-
data/jpa/docs/current/reference/html/#projections
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)