以下技术应用于最优质的水果的鲜果篮
定制类(自定义类)
public class CustomerCareModel {
private Date startDate;private String chargingSource;
private int topUpNum;
private Date lastBillingDate;
private Date endDate;
private BigDecimal price;
public CustomerCareModel() {
}
public CustomerCareModel(Date startDate, String chargingSource, int topUpNum,
Date lastBillingDate, Date endDate, BigDecimal price) {
this.setStartDate(startDate);
this.setChargingSource(chargingSource);
this.setTopUpNum(topUpNum);
this.setLastBillingDate(lastBillingDate);
this.setEndDate(endDate);
this.setPrice(price);
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
// getters and setters
}
使用:
String hql = "select new com.xx.CustomerCareModel"
+ "(us.startDate, us.chargingSource, us.topUpNum, us.lastBillingDate, us.endDate, st.price) "+ " from com.xx.UserSubscription us, "
+ " xx.SubscriptionType st "
+ " where us.subscriptionTypeId=st.subscriptionTypeId "
+ " and us.msisdn=:msisdn";
Query query= session.createQuery(hql);
query.setParameter("msisdn", "9876543210");
List<CustomerCareModel> customerCareList = query.list();