我有一个像这样的POJO
Class BillEntity {
private int id;
private double amount;
private List<Integer> paymentIds;
}
我想使用Hibernate标准从数据库中获取此Object,目前我的代码是这样的
DetachedCriteria criteria = DetachedCriteria.forClass(Bill.class);
//some Join aliases, which are working as expected
criteria.setProjection(Projections.projectionList()
.add(Projections.property("id") , "id")
.add(Projections.property("amount") , "amount");
criteria.setResultTransformer(new AliasToBeanResultTransformer(BillEntity.class));
criteria.list();
id
和amount
已正确填充,但我不确定如何填充paymentIds
。
赞赏任何指针!