PointDaoImpl

package com.huaweisymantec.rmc.core.dao.impl;

import java.util.List;

import javax.annotation.Resource;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.huaweisymantec.rmc.core.dao.PointDao;
import com.huaweisymantec.rmc.core.domain.RemoteClientPoint;
import com.huaweisymantec.rmc.core.utils.GenericDao;
@Component("pd")
public class PointDaoImpl implements PointDao {

private GenericDao gd;
private HibernateTemplate ht;

public HibernateTemplate getHt() {
return ht;
}
@Resource
public void setHt(HibernateTemplate ht) {
this.ht = ht;
}
public void savePoint(RemoteClientPoint rcp) {
ht.save(rcp);

}
public GenericDao getGd() {
return gd;
}
@Resource
public void setGd(GenericDao gd) {
this.gd = gd;
}

public RemoteClientPoint  getPoint(String rcpname) {
List<RemoteClientPoint> points = ht.find("from RemoteClientPoint  rcp where rcp.name='" + rcpname+ "'");
return points.get(0);

}
//删除局点
public void delPoint(RemoteClientPoint rcp) {

ht.delete(rcp);

}
//更新局点
public void updatePoint(RemoteClientPoint rcp) {
ht.update(rcp);

}
public boolean checkExist(String rcpname) {
List<RemoteClientPoint> points = ht.find("from RemoteClientPoint  rcp where rcp.name='" + rcpname+ "'");

if (points != null && points.size() > 0) {
return true;
}

else {
return false;
}
}


}

你可能感兴趣的:(DAO,orm)