private HibernateTemplate template = null;
public void setTemplate(HibernateTemplate template) {
this.template = template;
}
//保存
public void savephono(RPhone phono) throws Exception {
template.save(phono);
}
//修改
public void update(RTelgroup phoneGroup) throws Exception {
phoneGroup.setName("taozhangyi"); //修改名字
template.update(phoneGroup);
}
//查询(必须查询主键)
public RPhone findPhonoByphonoid(Integer phonoid) throws Exception { return (RPhone) template.get(RPhone.class, phonoid);
}
//查询(除主键外的其他字段)
public RTelgroup findPhoneGroupByGroup(Integer groupNo) {
return (RTelgroup) template.find(
"from RTelgroup pds where pds.groupno=?",new Object[] { groupNo }).get(0);
}
//删除
public void deletePhono(Integer phonoid) throws Exception {
template.delete(template.get(RPhone.class, phonoid));
}
public void setTemplate(HibernateTemplate template) {
this.template = template;
}
//保存
public void savephono(RPhone phono) throws Exception {
template.save(phono);
}
//修改
public void update(RTelgroup phoneGroup) throws Exception {
phoneGroup.setName("taozhangyi"); //修改名字
template.update(phoneGroup);
}
//查询(必须查询主键)
public RPhone findPhonoByphonoid(Integer phonoid) throws Exception { return (RPhone) template.get(RPhone.class, phonoid);
}
//查询(除主键外的其他字段)
public RTelgroup findPhoneGroupByGroup(Integer groupNo) {
return (RTelgroup) template.find(
"from RTelgroup pds where pds.groupno=?",new Object[] { groupNo }).get(0);
}
//删除
public void deletePhono(Integer phonoid) throws Exception {
template.delete(template.get(RPhone.class, phonoid));
}