我有两个实体:
public class Rank{
Short value;
@ManyToOne(fetch=FetchType.LAZY)
Picture pic;
...
}
public class Picture{
String url;
Long rank; // sum of all ranks' values
}
有没有办法通过查询加载Picture
和rank
字段SELECT SUM(value) from ranks where pic = ?
?