返回列表類型我有DTO結構,如:在JPA
public class ADto{
private String name;
private String id;
private List<BDto> bdtos;
//Created constructor using fields
}
public class BDto{
private String id;
private String code;
private List<CDto> cdtos;
//Created constructor using fields
}
public class CDto{
private String mKey;
private String mVal;
//Created constructor using fields
}
使用Spring MVC的用於獲取數據。
下面的查詢工作完全正常,並結合數據:
@org.springframework.data.jpa.repository.Query("select new pkg.ADto(id,name) from AEntity a where a.id=?1")
public ADto getAData(Long id);
我怎樣才能獲取數據,其又使用上述方法還列表組成的列表?
想要在提取單個ADto時返回'BDto'列表? –
@BranislavLazic是的.. – xyz